11

When I install my app it is asking for this permission:

prevent phone from sleeping

I assume that comes from the WAKE_LOCK permission but my app doesn't specify that. Here is the permission list from my manifest:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

I am linking with ACRA and Google Analytics but don't see how the permission could be coming from those.

UPDATE: here is my build.gradle for my main module. it does include google play analytics:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile project(':acra-4.7.0')
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
}

apply plugin: 'com.google.gms.google-services'

UPDATE: As suggested by CommonsWare found the culprit in the manifest:

ADDED from [com.google.android.gms:play-services-basement:8.4.0] 
C:\Users\Bill\Workspace\NetworkExplorer\app\build\intermediates\exploded-
    aar\com.google.android.gms\play-services-basement\
8.4.0\AndroidManifest.xml:23:13-66
uses-permission#android.permission.WAKE_LOCK

Seems like I should not need WAKE_LOCK for simple Google Analytics reporting.

Bill
  • 393
  • 4
  • 13
  • Don't you use something like FLAG_KEEP_SCREEN_ON? more here http://developer.android.com/training/scheduling/wakelock.html – Tomas Cejka Feb 04 '16 at 18:10
  • 3
    Quoting myself from [this answer](https://stackoverflow.com/a/30546670/115145): "...you will need to determine where the permissions are coming from. There should be a manifest merger report in `build/outputs/logs/` of your module. It will be a bit difficult to understand, but hopefully you can identify the library that is contributing this permission." – CommonsWare Feb 04 '16 at 18:12
  • Possible duplicate of http://stackoverflow.com/questions/32646830/more-permissions-in-uploaded-apk-than-in-manifest-file/32647054#32647054 – Kuffs Feb 04 '16 at 18:13
  • Thanks CommonsWare. It is coming from the google analytics: – Bill Feb 04 '16 at 18:47
  • Solved the problem by using the "remove" option on the WAKE_LOCK permission as suggested here: http://stackoverflow.com/questions/30960275/do-i-need-android-permission-wake-lock-for-google-play-services-if-i-only-releas – Bill Feb 04 '16 at 19:10

1 Answers1

4
<uses-permission android:name="android.permission.WAKE_LOCK" tools:node="remove" />

it'll do the job.

I hope it helps.

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58