我剛剛發佈了一個在其清單文件中具有兩個權限的應用程序(用於顯示橫幅廣告)。 「android.permission.INTERNET」和「android.permission.ACCESS_NETWORK_STATE」。爲了測試,我試圖從遊戲市場安裝我的應用程序,發現應用程序需要身份,位置,照片/媒體/文件!在我的清單文件中沒有這樣的權限,我不需要它們。嘗試使用類似的manifest.xml(互聯網,網絡狀態)我的其他應用程序,他們正在安裝沒有任何特殊的權限。 考慮到新的內容評級證書系統,我可能會遇到問題,因爲在問卷中,我標記了不需要用戶位置。 爲什麼它需要我沒有問的權限? 我使用過Android Studio和的build.gradle:用戶獲取未包含在清單中的權限請求
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.appName"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.PhilJay:MPAndroidChart:v2.1.0'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.nispok:snackbar:2.10.2'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.github.markushi:android-ui:1.2'
compile 'com.afollestad:material-dialogs:0.7.3.1'
}
的Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.AppPackage" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
<activity
android:name=".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>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".Prefs_Activity" >
</activity>
<activity
android:name=".Guide_Activity"
android:label="@string/title_activity_" >
</activity>
<activity
android:name=".Picker_Activity"
android:label="@string/title_activity_" >
</activity>
</application>
</manifest>
更新:
由於CommonsWare的答案我已經找到「清單合併釋放-report.txt「,以及誰使用這些權限。這些是地圖和錢包API。 我從這裏分開播放業務:
compile 'com.google.android.gms:play-services:7.5.0'
這(我需要現在):
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-appindexing:7.5.0'
結果:
- 去除不必要的權限
- APK縮小高達500kb
- 開始重視API分離
您使用哪種橫幅廣告sdk?也許該SDK是問題,並添加額外的權限 – itay83
我使用AdMob顯示橫幅 – despecher
您是否使用了一些第三方庫?你在使用AndroidStudio還是Eclipse?如果您是基於gradle的,請發佈應用程序模塊gradle文件和清單。看起來你的清單在打包時與包含這個權限的清單合併在一起。 –