Tien Do
Tien Do

Reputation: 11069

Why does PhoneGap create different config.xml files for same app?

I was using PhoneGap 3.0 CLI to create a sample app by this command:

phonegap create MyTestApp com.example.mytestapp MyTestApp

Then I saw two different config.xml files, below is what I saw in the project root www folder:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.mytestapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

where id attribute was correct and version was 1.0.0

But what I saw in the /platforms/ios/MyTestApp/config.xml was a bit different:

<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">

id was wrong and version was 2.0.0

Why are they different? You know, the iOS config.xml file is re-created each time we run phonegap build ios command.

Upvotes: 1

Views: 618

Answers (1)

Barsum
Barsum

Reputation: 156

It might seem confusing to see the different config.xml files if you’re perusing through what’s created by the CLI commands. There is a sample config.xml in your root www folder that is used when a project is built remotely by PhoneGap Build (via the phonegap build remote command).

However, when you are building locally for a platform you will make platform-specific changes to a config.xml file for each platform in a separate location. For instance, for android you will find it under a path like yourprojectroot/platforms/android/res/xml/config.xml.

For ios you will find it under yourprojectroot/platforms/ios/yourprojectname/config.xml. This might lead to confusion if you’re not paying attention since you will also see the sample one in the platforms www folder which was copied down from the root project. The one in the platform-specific directory is the one to update and modify.

PhoneGap 3.0 – Stuff You Should Know

Upvotes: 1

Related Questions