Saturday 7 November 2020

Android Gradle Plugin 4.1.0 grants Location permission automatically

Building app that declare Location permission in Manifest gets permissions granted by default at install time using latest AGP 4.1.0 !!!

Steps to Reproduce:

  • checkout and import in Android studio https://github.com/avianey/Android30LocationRational
  • connect a device or emulator running under sdk 29 or 30
  • run uninstallAll task from the gradle task panel to ensure app is uninstalled from device
  • run installRelease task from gradle task panel
  • open the app on the device
  • ACCESS_FINE_LOCATION and ACCESS_BACKGROUND_LOCATION are granted by default !

Expected behaviour:

  • permissions are not granted at install time

Notes:

  • reverting to classpath "com.android.tools.build:gradle:4.0.2" fix the issue
  • using compileSdkVersion/targetSdkVersion 29 or 30 changes nothing
  • when installing the app is using default install configuration from android studio, the issue is not present (permissions are not granted by default) see screenshot (red are bugguy, green is not and behave as expected)

enter image description here

As the result, bundled app submitted for review on the app store has the issue and do not pass compliant test for location permission rational were a dialog should be displayed before requesting permission... Can't find any clue on the AGP changelog page : https://developer.android.com/studio/releases/gradle-plugin

Any idea to avoid reverting to old build tools ?



from Android Gradle Plugin 4.1.0 grants Location permission automatically

No comments:

Post a Comment