Android studio adds unwanted permission after running application on real device -
after running application on device application required unwanted location permission not mention in manifest file. while when running same code friend android studio run normal without permission required.
manifest file
<uses-sdk android:minsdkversion="14" android:targetsdkversion="21" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="android.permission.call_phone" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="android.permission.use_credentials" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="com.android.vending.billing" /> <uses-permission android:name="com.samsung.android.providers.context.permission.write_use_app_feature_survey"/> <uses-feature android:name="android.hardware.telephony" android:required="false" /> <uses-permission android:name="android.permission.access_network_state" /> 
build.gradle
apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "xxxxxxx" minsdkversion 14 targetsdkversion 21 // enabling multidex support. multidexenabled true } dexoptions { javamaxheapsize "4g" } packagingoptions { exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' exclude 'meta-inf/license' exclude 'meta-inf/notice' } lintoptions{ abortonerror false } } repositories { mavencentral() } dependencies { compile project(':boxandroidlibraryv2') compile 'com.google.http-client:google-http-client-gson:1.19.0' compile 'com.google.code.gson:gson:2.1' compile 'com.google.android.gms:play-services:+' compile files('libs/hockeysdk-3.0.2.jar') compile files('libs/dropbox-android-sdk-1.6.3.jar') compile 'com.google.apis:google-api-services-drive:v2-rev164-1.20.0' compile files('libs/in-app-purchasing-2.0.59.jar') compile files('libs/json_simple-1.1.jar') compile 'com.android.support:multidex:1.0.0' compile 'com.android.support:appcompat-v7:21.0.3' compile files('libs/slf4j-api-1.7.5.jar') compile files('libs/jackrabbit-webdav-2.7.2.jar') compile files('libs/commons-httpclient-3.1.jar') compile project(':utilities') compile files('libs/pass-v1.1.3.jar') compile files('libs/sdk-v1.0.0.jar') compile 'com.google.api-client:google-api-client:1.20.0' compile 'com.google.oauth-client:google-oauth-client:1.20.0' compile 'com.google.api-client:google-api-client-android:1.20.0' compile 'com.google.http-client:google-http-client-android:1.20.0' } configurations { all*.exclude group: 'com.google.guava', module:'guava-jdk5' } so unable understand why require location permission. how location permission added in app?
compile 'com.google.android.gms:play-services:+' this library request location permissions, several pieces of play services need it.
first, never use +. if want allow free-floating patchlevels (e.g., 22.0.+), that's not insane, using + version is insane.
next, consider using 1 (or more) of more focused dependencies, rather full play services sdk. not perhaps eliminate permission not want, apk lot smaller. the documentation covers available options (see "selectively compiling apis executable" section).
if still wind permissions not want, need determine permissions coming from. there should manifest merger report in build/outputs/logs/ of module. bit difficult understand, can identify library contributing permission. also, android studio 2.2+ show merged manifest in sub-tab when edit manifest.
at point, need decide how proceed:
the safest answer removes permission no longer use library, instead find other solution whatever problem trying solve library
or, live permission
or, try adding following app's manifest:
<uses-permission android:name="android.permission.access_coarse_location" tools:node="remove" />
this require add xmlns:tools="http://schemas.android.com/tools" root <manifest> element if not there. tell build tools explicitly exclude permission, though libraries contributing it. however, your use of libraries may break. if have dedicated testing team can spend time needed ensure decision block permission not result in crashes or other behavior affects user.
Comments
Post a Comment