为什么我的应用程序具有 READ_PHONE_STATE 权限,尽管它没有在清单中声明? [英] Why does my app has the READ_PHONE_STATE permission although it's not declared in manifest?

查看:36
本文介绍了为什么我的应用程序具有 READ_PHONE_STATE 权限,尽管它没有在清单中声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 apk 上传到 google play 时,我注意到了 READ_PHONE_STATE 权限.我没有添加它,它也没有写在我的清单或我的项目的任何其他文件中.(我查看了所有图书馆以获得此权限)

I noticed the READ_PHONE_STATE permission when I uploaded the apk to google play. I have not added it and it is not written anywhere in my manifest or any other file of my project. (I looked through all libraries for this permission)

我的应用程序在我以前使用相同库的构建中没有此权限.自上次构建以来,我将 android studio 更新到版本 1,更新了我的 android sdk 并对我的应用程序进行了一些更改(在代码中).我没有在我的应用中请求设备 ID.

My app did not have this permission in my previous build with same libraries. Since last build I updated android studio to version 1, updated my android sdk and made a few changes (in code) to my app. I don't request the device ID in my app.

我的应用有 minSDK 14 且没有广告.这是我的清单权限:

My app has minSDK 14 and no ads. Here are my manifest permissions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

这是 apk 文件

推荐答案

我能够解决问题.类似于reneph的解决方案.

I was able to resolve the problem. It's similar to the solution of reneph.

我发现一个库在 build.gradle 和清单文件中都没有指定 minSDK.添加后

I found that one library had no minSDK specified neither in the build.gradle nor in the manifest file. After adding

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
}

权限消失了.我不知道为什么它在没有我之前构建的许可的情况下工作(也没有指定 minSDK).必须是 Android Studio 1.0 或 Android SDK 更新.

the permission was gone. I don't know why it worked without the permission on my previous build (also no minSDK specified). Must have been either the Android Studio 1.0 or the Android SDK update.

Android 开发者文档 READ_PHONE_STATE 权限:

Android developer documentation for READ_PHONE_STATE permission:

注意:如果您的 minSdkVersiontargetSdkVersion 值都设置为 3 或更低,系统会隐式授予您的应用此权限.如果您不需要此权限,请确保您的 targetSdkVersion 为 4 或更高.

Note: If both your minSdkVersion and targetSdkVersion values are set to 3 or lower, the system implicitly grants your app this permission. If you don't need this permission, be sure your targetSdkVersion is 4 or higher.

这篇关于为什么我的应用程序具有 READ_PHONE_STATE 权限,尽管它没有在清单中声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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