Google 使用 Android Studio 后播放检测新权限
Google Play detecting new permissions after using Android Studio
我刚刚从 Eclipse 切换到 Android Studio,当我更新我的应用程序时,google Play 商店在我新导出的 apk 中发现了三个新权限。
我正在引用清单文件和 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:+'
}
如您所见,清单中声明了三个权限,但 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
我正在使用颜色选择器模块和 google 广告,我在 eclipse 上制作项目并导入到 Android Studio。
编辑:
添加到同一个问题,我刚刚上传了另一个应用程序,这次我删除了一些权限并删除了一些库,但是这次,我得到了非常奇怪的权限。请看我附上的这张截图。
编辑 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
在清单和 build.gradle
中都设置为 21,因此唯一需要查看的地方是 ambilWarna
模块。如果 targetSdkVersion
为 3 或更少,清单合并可能会假定您在此处有一些代码需要 read/write 外部 storage/phone 状态并在构建期间将这些权限添加到您的应用程序。
顺便说一句,您可以从清单中删除以下行,因为 Gradle 将使用 build.gradle
文件中指定的值(与您的情况相同):
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
我刚刚从 Eclipse 切换到 Android Studio,当我更新我的应用程序时,google Play 商店在我新导出的 apk 中发现了三个新权限。 我正在引用清单文件和 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:+'
}
如您所见,清单中声明了三个权限,但 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
我正在使用颜色选择器模块和 google 广告,我在 eclipse 上制作项目并导入到 Android Studio。
编辑:
添加到同一个问题,我刚刚上传了另一个应用程序,这次我删除了一些权限并删除了一些库,但是这次,我得到了非常奇怪的权限。请看我附上的这张截图。
编辑 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
在清单和 build.gradle
中都设置为 21,因此唯一需要查看的地方是 ambilWarna
模块。如果 targetSdkVersion
为 3 或更少,清单合并可能会假定您在此处有一些代码需要 read/write 外部 storage/phone 状态并在构建期间将这些权限添加到您的应用程序。
顺便说一句,您可以从清单中删除以下行,因为 Gradle 将使用 build.gradle
文件中指定的值(与您的情况相同):
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />