Missing permissions from AndroidManifest.xml

I have installed the diagnostics plugin following the guide here: https://ionicframework.com/docs/native/diagnostic/

This worked fine, recently I cleaned up the whole project reinstalled angular and now when I try to run the app the AndroidManifest.xml is missing:

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

Same goes for Geolocation, i do not see the permissions in the generated AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

I can off course manually add them, but the manifest files get re-written at every compile.

I have tried to remove and readd the plugins but no dice, what and where should I check?

Thank you.

https://github.com/dpa99c/cordova-diagnostic-plugin#android-permissions

Thank you I’ll have a look, however I’m pretty sure I haven’t installed this in the past…

What do you mean here?

If you refer to the “cordova-custom-config” plugin mentioned in the docs, you might not need this any more with current cordova versions any more. Try adding it to config.xml directly if you need these permissions.

Yes I mean the cordova-custom-config plugin, and in whole honesty I do not remember editing the config.xml in the first place…

Anyway I have edited the config.xml as per description, now I can see the permissions are added to the AndroidManifest.xml but the build fails with:

F:\Neil\E-clean rewamp\APP\E-Clean\platforms\android\res\xml\config.xml:56: AAPT: Error parsing XML: unbound prefix

F:\Neil\E-clean rewamp\APP\E-Clean\platforms\android\build\intermediates\res\merged\debug\xml\config.xml:56: error: Error parsing XML: unbound prefix



FAILURE: Build failed with an exception.

Not sure if you are dealing with the problem anymore but I got around the unbound prefix issue by adding the android xmlns to my element.

<widget id="com.test.app" version="0.9.0" 
    xmlns="http://www.w3.org/ns/widgets" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:cdv="http://cordova.apache.org/ns/1.0">
3 Likes

Thank you sooo much! Holy smokes! I spent 7 days looking for this "
xmlns:android=“http://schemas.android.com/apk/res/android” @bnolan001
The unbound prefix issue is finally solved.

1 Like

Yaah Still working this solution in year 2020, Thanks!!