I have just switched from Eclipse to Android Studio and when I updated my app, the google play store found three new permissions in my new exported apk. I am quoting the manifest file and the gradle file:
<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>
The build.gradle of my module is:
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:+'
}
As you can see there are three permissions declared in the manifest but the play store detects the following permissions:
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
I am using a color picker module and google ads, I made the project on eclipse and imported in Android Studio.
EDIT: Adding to the same question, I just uploaded another app, this time I removed some permissions and removed some libraries, but this time, I got very strange permissions. Please look at this screenshot I'm attaching.
EDIT 2: Never mind, I found out it was due to my inclusion of play services's whole package instead of merely using Ads package
From the documentation on READ_PHONE_STATE
permission:
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.
From the documentation on WRITE_EXTERNAL_STORAGE
permission:
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.
From the documentation on READ_EXTERNAL_STORAGE
, permission:
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.
So, you need to set your targetSdkVersion
to 4 or higher. As your targetSdkVersion
is set to 21 in both manifest and build.gradle
, the only place to look at is ambilWarna
module. If is has targetSdkVersion
of 3 or less, manifest merger may assume that you have some code here which needs to read/write external storage/phone state and add these permissions to your app during the build.
BTW, you can remove following lines from the manifest because Gradle will use the values specified in build.gradle
file (which are the same in your case) instead:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.