我按照 https://permissions-dispatcher.github.io/doc/installation.html
里面的教程進行導入喊式,但卻發(fā)現(xiàn)我在build的時候出現(xiàn)這個異常
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:12:5-31:19 to override.
按照Suggestion添加replace無效冲九,解決方法如下:
1.安裝PermissionDispatcher Plugin
2.在你想寫權限的地方(Activity或Fragment)右鍵或者ALT+INSERT(MAC上是command+N),選擇Generate,然后選擇添加PermissinDispatcher依賴,自動導入了所需要的包
3.開始使用,同樣是上面的步驟到Generate界面底哥,然后選擇Generate Runtime Permissions洋腮,選擇所需權限后锈麸,提示rebuild烁涌,就可以使用了苍碟,問題解決。