我的Android应用突然需要未在AndroidManifest.xml中设置的权限.为什么? [英] My Android app suddenly requires permissions not set in AndroidManifest.xml. Why?

查看:540
本文介绍了我的Android应用突然需要未在AndroidManifest.xml中设置的权限.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,该应用程序在过去几年中仅进行了很小的更改.昨天我向Google Play发布了一个错误修正,发现我的应用突然需要5个新权限:

I have an app that have only had minor changes the last couple of years. Yesterday I released a bugfix to Google Play, and noticed that my app suddenly requires 5 new permissions:

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.GET_ACCOUNTS
  • android.permission.READ_EXTERNAL_STORAGE maxSdkVersion = 18
  • android.permission.USE_CREDENTIALS
  • android.permission.WRITE_EXTERNAL_STORAGE

我尚未对AndroidManifest.xml进行任何更改,因此此处未列出这5个权限.

I have not made any changes to AndroidManifest.xml, so these 5 permissions are not listed there.

我正在使用Google的结算库(com.android.billing)进行应用内购买.这可能已由Android Studio自动更新.

I'm using Google's billing library (com.android.billing) for in-app purchases. This might have been automatically updated by Android Studio.

我也已经升级了这些库:

I have upgraded these libraries as well:

  • com.android.support:appcompat-v7:22.1.1-> 22.2.0
  • com.android.support:support-v4:22.1.1-> 22.2.0
  • com.google.android.gms:play-services:7.3.0-> 7.5.0

有人知道为什么会这样吗?

Does anyone know why this happened?

使用答案更新

@ ahmad-nawaz是正确的,他的回答使我明白了这一点.这是我的问题的更详细的答案:

@ahmad-nawaz is right, and his answer led me to figure this out. Here is a more detailed answer to my question:

需要额外权限的库是 Google Play服务.

在Google Play Services 6.5及更高版本中,您可以(并且应该应该)定义所需的特定API,而不仅仅是导入整个程序包.

In Google Play Services version 6.5 and onward, you can (and probably should) define which specific API you need, instead of just importing the whole package.

就我而言,我只是在使用play-services-analytics,所以我在build.gradle中更改了它

In my case, I was just using play-services-analytics, so I changed this in my build.gradle

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

对此

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

此更改后,原始问题中提到的所有5个权限都消失了.

After this change, all the 5 permissions mentioned in the original question disappeared.

以下是Google Play服务的各个API的完整列表: https://developers.google.com/android/guides/setup#split

Here is the complete list of the individual APIs of Google Play Services: https://developers.google.com/android/guides/setup#split

推荐答案

这些来自您使用的库. Android Studio将库权限合并到应用程序中.

These are coming from Libraries you used. Android studio merge the libraries permissions into app.

这篇关于我的Android应用突然需要未在AndroidManifest.xml中设置的权限.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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