gpt4 book ai didi

java - Google Play 在使用 Android Studio 后检测到新权限

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:47:31 24 4
gpt4 key购买 nike

我刚刚从 Eclipse 切换到 Android Studio,当我更新我的应用程序时,google play 商店在我新导出的 apk 中发现了三个新权限。我正在引用 list 文件和 gradle 文件:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appsbyusman.simplecolorwallpaper"
android:versionCode="2"
android:versionName="1.1" >

<uses-permission android:name="android.permission.SET_WALLPAPER" />

<!-- Include required permissions for Google Mobile Ads to run -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<!-- This meta-data tag is required to use Google Play Services. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<!-- Include the AdActivity configChanges and theme. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.appsbyusman.simplecolorwallpaper.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

我模块的build.gradle是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "19.1.0"

defaultConfig {
applicationId "com.appsbyusman.simplecolorwallpaper"
minSdkVersion 11
targetSdkVersion 21
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile project(':ambilWarna')
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:+'
}

如您所见, list 中声明了三个权限,但 Play 商店检测到以下权限:

android.permission.ACCESS_NETWORK_STATE
android.permission.INTERNET
android.permission.READ_EXTERNAL_STORAGE maxSdkVersion=18
android.permission.READ_PHONE_STATE
android.permission.SET_WALLPAPER
android.permission.WRITE_EXTERNAL_STORAGE maxSdkVersion=18

我正在使用颜色选择器模块和谷歌广告,我在 eclipse 上制作项目并导入到 Android Studio 中。

编辑:添加到同一个问题,我刚刚上传了另一个应用程序,这次我删除了一些权限并删除了一些库,但是这次,我得到了非常奇怪的权限。请看我附上的这张截图。 enter image description here

编辑 2:没关系,我发现这是因为我包含了播放服务的整个包,而不是仅仅使用广告包

最佳答案

来自关于READ_PHONE_STATE权限的文档:

Allows read only access to phone state.

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.

来自WRITE_EXTERNAL_STORAGE 权限的文档:

Allows an application to write to external storage.

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_EXTERNAL_STORAGE 的文档,权限:

Allows an application to write to external storage.

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.

因此,您需要将targetSdkVersion 设置为4 或更高。由于您的 targetSdkVersion 在 list 和 build.gradle 中都设置为 21,因此唯一需要查看的地方是 ambilWarna 模块。如果它的 targetSdkVersion 为 3 或更低, list 合并可能会假定您在此处有一些代码需要读取/写入外部存储/手机状态,并在构建期间将这些权限添加到您的应用。

顺便说一句,您可以从 list 中删除以下行,因为 Gradle 将使用 build.gradle 文件中指定的值(在您的情况下是相同的):

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />

关于java - Google Play 在使用 Android Studio 后检测到新权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27792660/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com