Android 清单权限外部存储
Android Manifest Permissions External Storage
我在清单中定义了以下权限,但我仍然看到 Android 询问应用程序需要写入外部存储的权限,即使我不想访问外部存储
难道是因为Google播放服务
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
缺少这个:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
添加这些权限
<uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="ANDROID.PERMISSION.WRITE_EXTERNAL_STORAGE"/>
请尝试这个 google 播放服务错误:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="Version code" />
应用程序结束时使用了元数据。
post 发表已经快一年了,但也许这会对某些人有所帮助。
如果您使用的 play-services 版本 < 8.3,则 play-services-maps 使用此权限。
如果您没有使用 play-services-maps,那么您可能正在使用将地图作为传递依赖的 play-services-fitness。
如果您没有使用 nor of them,那么您可能有其他需要此权限的传递依赖项。
这可能是由于以下两个原因。
- If you're targeting version 8.3 or later of the
Google Play services SDK
, you no longer need the WRITE_EXTERNAL_STORAGE
permission to use the Google Maps Android API.
- If you're targeting earlier versions of the Google Play services
SDK, you must request the
android.permission.WRITE_EXTERNAL_STORAGE permission.
检查this link。
- There was a bug in Google play services that causes unintended
WRITE_EXTERNAL_STORAGE
, READ_EXTERNAL_STORAGE
, and
READ_PHONE_STATE
permissions to be merged into app manifests. That
is solved in Google Play services 10.0 release. Check this.
为避免这种情况,我建议包括必要的个人 Play 服务 API 和相应的 build.gradle 描述。检查 this.
希望这对您和未来的用户也有帮助。
我在清单中定义了以下权限,但我仍然看到 Android 询问应用程序需要写入外部存储的权限,即使我不想访问外部存储
难道是因为Google播放服务
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
缺少这个:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
添加这些权限
<uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="ANDROID.PERMISSION.WRITE_EXTERNAL_STORAGE"/>
请尝试这个 google 播放服务错误:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="Version code" />
应用程序结束时使用了元数据。
post 发表已经快一年了,但也许这会对某些人有所帮助。 如果您使用的 play-services 版本 < 8.3,则 play-services-maps 使用此权限。
如果您没有使用 play-services-maps,那么您可能正在使用将地图作为传递依赖的 play-services-fitness。
如果您没有使用 nor of them,那么您可能有其他需要此权限的传递依赖项。
这可能是由于以下两个原因。
- If you're targeting version 8.3 or later of the
Google Play services SDK
, you no longer need theWRITE_EXTERNAL_STORAGE
permission to use the Google Maps Android API.- If you're targeting earlier versions of the Google Play services SDK, you must request the android.permission.WRITE_EXTERNAL_STORAGE permission.
检查this link。
- There was a bug in Google play services that causes unintended
WRITE_EXTERNAL_STORAGE
,READ_EXTERNAL_STORAGE
, andREAD_PHONE_STATE
permissions to be merged into app manifests. That is solved in Google Play services 10.0 release. Check this.
为避免这种情况,我建议包括必要的个人 Play 服务 API 和相应的 build.gradle 描述。检查 this.
希望这对您和未来的用户也有帮助。