Adding the Layer library dependency in Android suppresses requestPermissions dialog

前端 未结 1 1096
名媛妹妹
名媛妹妹 2021-01-17 04:40

I made a very, very small demo app reproducing the bug on a Nexus 5 running Android version 6.0.1. The app is on github here: https://github.com/lexi-sr/LayerPermission

相关标签:
1条回答
  • 2021-01-17 05:05

    Luckily, the layer support team was able to help me with this. It solved my problem in the demo app (which targeted SDK 23) and my real app (which targeted SDK 22, to avoid requesting permissions at runtime). After I put tools:node="replace" into my uses-permission line for GET_ACCOUNTS, the pop up dialog was able to appear and grant the permission in the demo app, and the permission was no longer missing in the real app which targeted SDK 22.

    Here is the detailed explanation from the Layer support team:

    The layer SDK requests the GET_ACCOUNTS permission using a maxSdkVersion of 18. It would appear that when the manifests get merged this is overwriting the permission request in your manifest, thus not requesting that permission for 19+. Could you try appending tools:node="replace" to the permission in your app's manifest? The line should read as:

    <uses-permission android:name="android.permission.GET_ACCOUNTS" tools:node="replace" />
    

    See here for the maxSdkVersion documentation: http://developer.android.com/guide/topics/manifest/uses-permission-element.html

    See here for the tools:node documentation: http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:node-markers

    Peter

    0 讨论(0)
提交回复
热议问题