为什么在包含 Google Play 服务库时会自动将权限添加到我的 AndroidManifest 中 [英] Why are permissions being automatically added to my AndroidManifest when including Google Play Services library

查看:27
本文介绍了为什么在包含 Google Play 服务库时会自动将权限添加到我的 AndroidManifest 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当我在 build.gradle 文件中使用以下权限时会自动添加以下权限

I noticed that the following permissions were automatically added when i use the following in my build.gradle file

compile 'com.google.android.gms:play-services:7.5.0'

较早版本的播放服务不会出现这种情况.有没有人有删除这些不需要的权限的解决方案?

This did not occur with the earlier versions of the play-services. does anyone have a solution to remove these unwanted permissions?

我只使用广告功能(INTERNET 和 ACCESSNETWORK_STATE).我不需要 LOCATION 和 USE_CREDENTIALS 权限.如何删除这些不需要的权限?

I am only using the ads function (INTERNET and ACCESSNETWORK_STATE). I got no need for the LOCATION and USE_CREDENTIALS permissions. How do you remove these unwanted permissions?

我注意到'manifest-merger-xxx-debug-report.txt'文件包含以下内容

I noticed that the 'manifest-merger-xxx-debug-report.txt' file contains the following

 ...<snipped bunch of other merges>
MERGED from com.google.android.gms:play-services-maps:7.5.0:22:5
    android:name
        ADDED from com.google.android.gms:play-services-maps:7.5.0:22:22
uses-permission#android.permission.ACCESS_COARSE_LOCATION
ADDED from com.google.android.gms:play-services-maps:7.5.0:23:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:23:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:23:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:23:5
    android:name
        ADDED from com.google.android.gms:play-services-maps:7.5.0:23:22
uses-feature#0x00020000
ADDED from com.google.android.gms:play-services-maps:7.5.0:24:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:24:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:24:5
MERGED from com.google.android.gms:play-services-maps:7.5.0:24:5
    android:glEsVersion
        ADDED from com.google.android.gms:play-services-maps:7.5.0:25:8
    android:required
        ADDED from com.google.android.gms:play-services-maps:7.5.0:26:8
android:uses-permission#android.permission.READ_EXTERNAL_STORAGE
IMPLIED from AndroidManifest.xml:2:1 reason: com.google.android.gms.maps requested WRITE_EXTERNAL_STORAGE
uses-permission#android.permission.GET_ACCOUNTS
ADDED from com.google.android.gms:play-services-wallet:7.5.0:21:5
    android:name
        ADDED from com.google.android.gms:play-services-wallet:7.5.0:21:22
uses-permission#android.permission.USE_CREDENTIALS
ADDED from com.google.android.gms:play-services-wallet:7.5.0:22:5
    android:name
        ADDED from com.google.android.gms:play-services-wallet:7.5.0:22:22
meta-data#com.google.android.gms.wallet.api.enabled
 ...<snips more lines away>

推荐答案

使用时

compile 'com.google.android.gms:play-services:7.5.0'

这意味着您正在使用 Google Play 服务的所有功能,包括位置服务.如果您只需要特定的 API,则应该使用选择性 API.

This implies you are using every feature of Google Play Services, including location services. If you only need a particular API, you should be using the selective APIs.

对于广告,您可以单独使用:

In the case of ads, you can use solely:

compile 'com.google.android.gms:play-services-ads:7.5.0'

这篇关于为什么在包含 Google Play 服务库时会自动将权限添加到我的 AndroidManifest 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆