为什么权限被自动添加到包括谷歌播放服务库时,我AndroidManifest [英] Why are permissions being automatically added to my AndroidManifest when including Google Play Services library

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

问题描述

我注意到以下权限时,我用我的build.gradle文件中的下列自动添加

 编译com.google.android.gms:玩-服务:7.5.0
 

这并没有发生与早期版本的播放服务。 没有任何人有一个解决方案,以消除这些不必要的权限?

我只使用了广告功能(互联网和ACCESSNETWORK_STATE)。 我没有必要的位置和USE_CREDENTIALS权限。 你如何删除这些不必要的权限?

我注意到,清单合并-XXX-调试REPORT.TXT'文件包含以下

  ...<剪断其它许多合并的制造>
从com.google.android.gms已合并:播放服务,地图:7.5.0:22:5
    机器人:名称
        从com.google.android.gms增加:播放服务,地图:7.5.0:22:22
使用-许可#android.permission.ACCESS_COARSE_LOCATION
从com.google.android.gms增加:播放服务,地图:7.5.0:23:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:23:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:23:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:23:5
    机器人:名称
        从com.google.android.gms增加:播放服务,地图:7.5.0:23:22
使用特征#0x00020000
从com.google.android.gms增加:播放服务,地图:7.5.0:24:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:24:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:24:5
从com.google.android.gms已合并:播放服务,地图:7.5.0:24:5
    机器人:glEsVersion
        从com.google.android.gms增加:播放服务,地图:7.5.0:25:8
    机器人:要求
        从com.google.android.gms增加:播放服务,地图:7.5.0:26:8
机器人:用途,权限#android.permission.READ_EXTERNAL_STORAG​​E
2:从AndroidManifest.xml中隐含的1原因:com.google.android.gms.maps要求WRITE_EXTERNAL_STORAG​​E
使用-许可#android.permission.GET_ACCOUNTS
从com.google.android.gms增加:播放服务钱包:7.5.0:21:5
    机器人:名称
        从com.google.android.gms增加:播放服务钱包:7.5.0:21:22
使用-许可#android.permission.USE_CREDENTIALS
从com.google.android.gms增加:播放服务钱包:7.5.0:22:5
    机器人:名称
        从com.google.android.gms增加:播放服务钱包:7.5.0:22:22
元数据#com.google.android.gms.wallet.api.enabled
 ...<剪多行远>
 

解决方案

在使用

 编译com.google.android.gms:玩-服务:7.5.0
 

这意味着你使用的谷歌的每一个的功能播放服务,包括位置服务。如果你只需要一个特定的API,你应该使用选择性的API 的。

在广告的情况下,可以单独使用:

 编译com.google.android.gms:玩 - 服务 - 广告:7.5.0
 

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?

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?

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>

解决方案

When you use

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

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'

这篇关于为什么权限被自动添加到包括谷歌播放服务库时,我AndroidManifest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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