Android 通过意图共享映像失败

Android 通过意图共享映像失败,android,image,android-intent,Android,Image,Android Intent,我正在尝试使用意图共享图像。请找到相同的函数 if(view.getId()==R.id.sendImage){ Uri imgUri=Uri.parse("android.resource://com.example.watchyalist/mipmap/"+R.mipmap.test); intent=new Intent(Intent.ACTION_SEND); intent.setType("i

我正在尝试使用意图共享图像。请找到相同的函数

        if(view.getId()==R.id.sendImage){
        Uri imgUri=Uri.parse("android.resource://com.example.watchyalist/mipmap/"+R.mipmap.test);
        intent=new Intent(Intent.ACTION_SEND);
        intent.setType("image/*");
        intent.putExtra(Intent.EXTRA_STREAM,imgUri);
        intent.putExtra(intent.EXTRA_TEXT,"Please find the image");
        chooser=Intent.createChooser(intent,"Choose the app");
        startActivity(chooser);
    }
这里的测试是我所指的图像,它通过whatsapp共享时发送bin文件。我试过使用ic_启动器,然后它说共享失败。这是我清单文件的快照

 android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

我无法理解它。我尝试将manifest标签更改为drawable,并相应地将imag保持为drawable,并相应地进行更改,但仍然没有成功。我在project中的mipmap-anydpi-v26文件夹中保存了图像,并尝试更改位置,但没有任何用处。请任何人提供帮助?谢谢

EXTRA\u STREAM
是采用
Uri
内容:
方案<代码>android。资源:不是
内容:
。当任何应用程序从你的应用程序接收到你的
Uri
时,都不需要知道如何处理它。另外,您的
Uri
以半随机数结尾(无论
R.mipmap.test
是否适用于此构建)

请将图像复制到文件(例如,在
getCacheDir()
中),然后使用
FileProvider
getUriForFile()
获取
Uri
以用于
额外流