Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit AndroidManifest.xml in PhoneGap 3

It seems PhoneGap generates that file automatically when config.xml is modified.

I wish to add Ad network's activities, services, etc in AndroidManifest.xml but I can't find the correct way to edit that file.

like image 589
Andrew Avatar asked Feb 03 '14 00:02

Andrew


People also ask

How do I edit AndroidManifest xml?

You can edit the XML manually by clicking on the AndroidManifest. xml tab. Android manifest files generally include a single <manifest> tag with a single <application> tag.

What is the AndroidManifest xml?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is the root element of AndroidManifest xml?

The root element of the AndroidManifest. xml file. It must contain an <application> element and specify xmlns:android and package attributes. Defines the Android namespace.


3 Answers

Phonegap uses config.xml to create androidmanifest.xml when you add the android platform to a project. It is also modified when you add plugins and build the project (for example, it adds the required permission for the plugin).

But you can also manually edit the file in platforms/android/AndroidManifest.xml to add permissions, configure the activity or the application... it will not be lost when you rebuild your project.

like image 68
QuickFix Avatar answered Nov 01 '22 11:11

QuickFix


Typically this is found in the "res" directory ( - src - gen [Generated Java Files] - Android - Android Dependencies - Referenced Libraries - assets - bin - libs - res - AndroidManifest.xml - proguard-project.txt - project.properties) of course this is depending on what version of Cordova you are using. Typically most of these things are specified in the config.xml for newer Phonegap builds from my understanding which is why you don't need to include an AndroidManifest.xml file when using Phonegap Build. I would recommend trying Configap to edit the main config.xml and see if any of the settings/services you need to access are options. Configap can be found here!

forgot to mention I use Notepad++ to edit my .xml on the fly but you can also open in the sdk

like image 23
user3261881 Avatar answered Nov 01 '22 11:11

user3261881


You probably want to check out cordova-custom-config.

It supports many extra settings in the cordova config.xml to customise the AndroidManifest.xml.

I'm using it to change the android:configChanges setting (adding uiMode to stop it from reloading when docking/undocking) and it works great.

The cordova-custom-config github page shows a full example with all supported options so it's very easy to setup.

like image 27
SystemParadox Avatar answered Nov 01 '22 11:11

SystemParadox