为什么包含 Google Play 服务库时权限会自动添加到我的 AndroidManifest

Why are permissions being automatically added to my AndroidManifest when including Google Play Services library(为什么包含 Google Play 服务库时权限会自动添加到我的 AndroidManifest)
本文介绍了为什么包含 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)