【问题标题】:Android Environment.isExternalStorageLegacy() always return trueAndroid Environment.isExternalStorageLegacy() 总是返回 true
【发布时间】:2019-11-18 13:31:34
【问题描述】:
我构建了一个小应用程序,在应用程序的 AndroidManifest.xml 中使用 compileSdkVersion 29、targetSdkVersion 29 进行编译,我可以指定
android:requestLegacyExternalStorage="false"
或将其完全删除。我从 Android 10 模拟器(Android Studio 附带的最新版模拟器)中卸载该应用程序。然后安装并检查 Environment.isExternalStorageLegacy();它总是返回真。我错过了什么?
【问题讨论】:
标签:
android
scoped-storage
【解决方案1】:
好的,找到原因了:我的AndroidManifest.xml我也在用:
android:sharedUserId="some.package.name.shared"
android:sharedUserLabel="@string/some_uuid_name"
其他旧模式应用程序仍在安装中。删除 sharedUserId(或者我猜,卸载共享 ID 的其他旧版应用程序)可以解决问题。