Reputation: 157
We are developing an application in Cordova with few plugins. Recently our build stopped working and as I was looking for solution, I found android.json file in plugins directory. There is a key "installed_plugins" with all my plugins installed, each one with key PACKAGE_NAME. What's bugging me is that its value differs for some plugins:
"installed_plugins": {
"com.tsukurusha.cordova.screenorientation": {
"PACKAGE_NAME": "sk.company.app"
},
"org.apache.cordova.file": {
"PACKAGE_NAME": "namespace.umk"
},
"com.plugin.datepicker": {
"PACKAGE_NAME": "sk.app.module"
},
"org.apache.cordova.inappbrowser": {
"PACKAGE_NAME": "sk.app.module"
},
...
*note, I changed real PACKAGE_NAME keys, for random words, but generally it looks like this.
I wasn't able to found what this PACKAGE_NAME means, nor where it came from. Do you have any idea what is their purpouse, or point me to some resources where I can find something about it (I looked in Cordova docs, but no luck)?
Upvotes: 2
Views: 2556
Reputation: 2857
That file indicates which plugins are installed in the current build of your cordova project for the given platform (android, ios, etc.). The values inside each plugin are the variables the plugin will use. It's possible in your case that you only see PACKAGE_NAME, since that's the only default variable that cordova will create when installing a plugin, but there may be other variables depending on the plugin. For example, I am using a plugin for facebook named cordova-plugin-facebook4. The entry in android.json for this plugin looks like this:
"cordova-plugin-facebook4": {
"APP_ID": "123456789",
"APP_NAME": "Facebook App Name",
"PACKAGE_NAME": "com.example"
}
and it was installed with the following command:
cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="Facebook App Name"
The documentation explaining this can be found in the following link (Variables section): https://cordova.apache.org/docs/en/4.0.0/plugin_ref/spec.html
In most cases, the value of PACKAGE_NAME is probably irrelevant. That variable is declared by cordova by default, but most plugins don't use it for anything. The reason why the value is different for each plugin is because plugins are not updated whenever you create a new build, once you install them they don't change. So the PACKAGE_NAME of each plugin is the id you had in config.xml when you first added that plugin. In order to fix this (in case the plugin really uses PACKAGE_NAME), you need to remove the plugin and add it again. Or in case you have all this persisted in config.xml, you can remove and add the platform.
Upvotes: 4
Reputation: 302
I can only guess based on my experience:
The Package Name is the Name of your app:
http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface
The second argument com.example.hello provides your project with a reverse domain-style identifier. This argument is optional, but only if you also omit the third argument, since the arguments are positional. You can edit this value later in the config.xml file, but do be aware that there may be code generated outside of config.xml using this value, such as Java package names. The default value is io.cordova.hellocordova, but it is recommended that you select an appropriate value.
And in my case it looks like this for each plugin:
"PACKAGE_NAME": "io.cordova.hellocordova"
Upvotes: 1