Android 10将文件保存到ExternalFilesDir无法在Google Play中运行

在我的Xamarin应用程序中,我将照片保存在应用程序特定的存储中,将其压缩,然后将其保存在Firebase存储中。 因此,我不需要READ / WRITE_EXTERNAL_STORAGE权限-https://developer.android.com/training/data-storage

在API级别29下,保存图片没有问题。 即使使用API​​级别29,当我使用Buildtype degub / release或创建并安装签名的发行版APK时,该应用程序仍能正常工作。 targetdk 28或29之间也没有区别

但是当我从Playstore安装应用程序时,它崩溃了,因为该应用程序未保存文件

at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.26(intptr,intptr,int,intptr).(unknown.cs:1)
  at   --- End of managed Java.IO.FileNotFoundException stack trace ---. (unknown.cs:1)
  at java.io.FileNotFoundException: /storage/emulated/0/Android/data/at.BoomShakalaka.SmoDoSa/files/WhiteEditionKokos-BlaubeereRedBullÖsterreichEnergydrink25025.06.2020.Jpeg: open failed: ENOENT  (No such file or directory).(unknown.cs:1)
  at    at crc647364884af208b96c.AddDoseFragment.n_onactivityResult (Native Method).(unknown.cs:1)
  at    at crc64351d59c463b0e83b.Mainactivity.n_onactivityResult (Native Method).(unknown.cs:1)
  at    at java.lang.reflect.Method.invoke (Native Method).(unknown.cs:1)
  at Caused by: android.system.ErrnoException: open failed: ENOENT  (No such file or directory).(unknown.cs:1)
  at    at libcore.io.Linux.open (Native Method).(unknown.cs:1)
  at    ... 21 more. (unknown.cs:1)

仅当我从Google Play商店安装应用程序时,才会在API级别29上发生这种情况。因此,我无法在应用程序代码中使用android:requestLegacyExternalStorage =“ true”测试该应用程序,而不会发布可能无法正常工作的新版本要么。

有人解释为什么Google Play商店中的应用程序的行为与直接在手机上安装签名发行的APK时的行为有所不同,以及我如何获得与Google Playstore相同的条件?

最诚挚的问候

iCMS 回答:Android 10将文件保存到ExternalFilesDir无法在Google Play中运行

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2046234.html

大家都在问