0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Xiaomi 端末で File Provider 経由でファイルが共有できない(シェアなどが正しく動作しない)

Posted at

はじめに

Xiaomi Redmi 9A で File Provider 経由でファイル共有するための Intent を投げると、以下のように Intent を受け取った側でエラーが出てしまい非常に困ったので調査しました。

java.io.FileNotFoundException: No content provider: content://mymy.package.debug.fileprovider/provided_dir/data.png
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1994)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1823)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1500)
at com.android.photos.BitmapRegionTileSource$UriBitmapSource.regenerateInputStream(BitmapRegionTileSource.java:267)
at com.android.photos.BitmapRegionTileSource$UriBitmapSource.readExif(BitmapRegionTileSource.java:304)
at com.android.photos.BitmapRegionTileSource$BitmapSource.loadInBackground(BitmapRegionTileSource.java:170)
at com.android.wallpapercropper.WallpaperCropActivity$3.doInBackground(WallpaperCropActivity.java:152)
at com.android.wallpapercropper.WallpaperCropActivity$3.doInBackground(WallpaperCropActivity.java:148)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)

解決方法

Xiaomi の一部の端末では簡単には adb インストールをさせてくれないので 「MIUIの最適化をオンにする」をオフにしていました。

なんとこれがオフになっているだけでエラーが発生する・・・。

「設定アプリ」 -> 「追加設定」 -> 「開発者向けオプション」 -> 「MIUIの最適化をオンにする」をオンに戻すだけ解決。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?