- 当前 Bug 的表现(可附上截图)
利用原生Intent分享视频至微信7.0版本,提示无法导入。查看Log发现是uri没有被正确解析。
视频实际路径为/storage/emulated/0/JKVD/精彩时刻(二连击破,残血击杀) 12-30.mp4,但根据Log可以看出,被解析为/external-path/JKVD/精彩时刻(二连击破,残血击杀) 12-30.mp4 is null。
其中external-path为FileProvider的配置文件中外置存储根目录。
2019-01-09 20:28:42.505 1329-2219/? I/ActivityManager: START u0 {act=android.intent.action.SEND typ=video/* flg=0xb080001 cmp=com.tencent.mm/.ui.tools.ShareImgUI clip={video/* U:content://${applicationId}.fileprovider/external-path/JKVD/%E7%B2%BE%E5%BD%A9%E6%97%B6%E5%88%BB(%E4%BA%8C%E8%BF%9E%E5%87%BB%E7%A0%B4%2C%E6%AE%8B%E8%A1%80%E5%87%BB%E6%9D%80)%2012-30.mp4} (has extras)} from uid 10168 pid -1
2019-01-09 20:28:42.972 1329-7087/? I/ActivityManager: START u0 {act=android.intent.action.SEND dat=content://${applicationId}.fileprovider/external-path/JKVD/精彩时刻(二连击破,残血击杀) 12-30.mp4 flg=0x1f080001 cmp=com.tencent.mm/.ui.transmit.MsgRetransmitUI clip={video/* U:content://${applicationId}.fileprovider/JKVD/%E7%B2%BE%E5%BD%A9%E6%97%B6%E5%88%BB(%E4%BA%8C%E8%BF%9E%E5%87%BB%E7%A0%B4%2C%E6%AE%8B%E8%A1%80%E5%87%BB%E6%9D%80)%2012-30.mp4} (has extras)} from uid 10110 pid 7400
2019-01-09 20:28:47.636 7400-7614/? W/MediaMetadataRetriever: fd of /external-path/JKVD/精彩时刻(二连击破,残血击杀) 12-30.mp4 is null
- 相关代码
AndroidManifest.xml
< provider android:name = "android.support.v4.content.FileProvider" android:authorities = "${applicationId}.fileprovider" android:exported = "false" android:grantUriPermissions = "true" > < meta-data android:name = "android.support.FILE_PROVIDER_PATHS" android:resource = "@xml/filepaths" /> </ provider > |
filepaths.xml
< paths > < external-path name = "external-path" path = "/" /> </ paths > |
分享视频相关代码:
Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setType( "video/*" ); intent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(intent, "分享视频" )); |
请问你是说分享一个视频小程序?