简体   繁体   中英

Ionic Cordova - How to add <permission> tag in Android Manifest.xml

I can add uses-permission using the code as such -

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/uses-permission" xmlns:android="http://schemas.android.com/apk/res/android">
            <uses-permission android:name="android.permission.INTERNET" />
</edit-config>

I use the same code structure below to add permission , however I got error "Unable to graft xml at selector "/manifest/permission" when add android platform

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/permission" xmlns:android="http://schemas.android.com/apk/res/android">
            <permission android:name="test.mobile" />
</edit-config>

Use config-file instead to add permission tag in Android Manifest.xml

<config-file parent="/manifest" target="app/src/main/AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
            <permission android:name="test.mobile" />
</config-file>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM