Open sanitul opened 5 years ago
I think officially, we don't support changing the ID of a project after it is generated. The version number should be updating though.
@dpogue, okay I understand about the project ID. But my problem was, I changed the app version to 0.2.62 in config.xml file
<?xml version='1.0' encoding='utf-8'?>
<widget version="0.2.62" 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" xmlns:tools="http://schemas.android.com/tools">
<name>meed</name>
<description>An awesome Ionic/Cordova app.</description>
After the android build success it still showing the old version 0.2.55, it doesn’t get updated in AndroidManifest.xml file. So I'm unable to change the apk version.
I think you need to use android-versionCode to update your GPlay version; the following code works
<widget android-versionCode="100224" id="xxxxxxxxxxxx" version="2.2.4"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
You shouldn't need to use android-versionCode
. If this property is not supplied, it will create a version code for you based on your version
.
By default, the formula is PATCH + MINOR * 100 + MAJOR * 10000
as seen here:
https://github.com/apache/cordova-android/blob/5dfa995a4b43a30c01afd519a22fdfaacb01c013/bin/templates/cordova/lib/prepare.js#L254-L269
With that being said, if you do define android-versionCode
anywhere manually, then you'll need to make sure you manually update them.
Is there any update on this, as this issue seems to be occurring still. I am experiencing this exact problem. On the first several builds, cordova seems to take the version number from config.xml, but after that it just refuses and doesn't read the config.xml value anymore.
Has any fix been done for this, as I'm sure this is an issue many people are running into.
Below is my env info.
`
Ionic:
ionic (Ionic CLI) : 4.0.1
Ionic Framework : ionic-angular 3.9.4-201903121725
@ionic/app-scripts : 3.2.3
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 8.0.0, ios 5.0.0
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v10.15.1 (/Users/joe/.nvm/versions/node/v10.15.1/bin/node)
npm : 6.4.1
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
Environment:
`
I'm also facing this issue any ideas?
Also facing this issue
I experienced this issue after having built the previous version beforehand, looked like the old config.xml was cached in gradle or something. I fixed by just terminating the process, restarted terminal, and then re-ran the build. A new gradle daemon should start, after which my AndroidManifest.xml was updated
I experienced this issue after having built the previous version beforehand, looked like the old config.xml was cached in gradle or something. I fixed by just terminating the process, restarted terminal, and then re-ran the build. A new gradle daemon should start, after which my AndroidManifest.xml was updated
Same issue, quiting terminal and then building again fixed the issue for me also.
I am unable to reproduce this using the latest cordova tooling. One common attribute between the people who have stated they see this issue all have ionic installed.
To rule out if ionic is somehow involved, it would be helpful if one can determine if the bug is reproducible without ionic. A minimal reproduction app may be required to move this issue further.
Long-time Cordova user here. I experienced this today and had to terminate my terminal tab/process and run again in a new process.
ionic cordova build android --release
OSX: 10.15.4 Cordova: 9.0.0 (cordova-lib@9.0.1)
Same problem here, any news?
I'm also facing this problem. If I change version in config.xml or AndroidManifest.xml manually, it is being reset after build. In order to upload the generated apk file to Google Play I need to change the version, but don't know how to do it with the program having change it automatically.
In my case I have a monorepo with one cordova setup and multiple Ionic apps with shared code base. Anyway, as I see, the app id is embedded anywhere in files and path name in platforms folder. I know that this issue is about the version, now. But initially also about the app-id. So just for clarification and self-interest:
I found some files in platforms folder with the app-id:
app/src/main/res/xml/config.xml
<widget id="your.app.id">
app/src/main/java/your/app/id/MainActivity.java (app id in path name)
package your.app.id
android.json
{
"installed_plugins": {
"several": {
"PACKAGE_NAME": "your.app.id"
}
}
}
You see that the app-id occurs in some files and folder names. I don't know why Google chose this architecture. In my opinion it should be one source for these meta data. But anyway...
It's hard to update all this existing data. You we have to remove the platforms folder when changing meta data like the app id. The downside is that the build will take more time to get these files again. I doubt we can find a better solution here, right?
Please correct me if I'm wrong or missed something. What files / folder should be removed when the app-id, name, etc. are changed? Only the platforms folder?
Is there a way to detect this via Cordova? Show a warning that the app-id, etc. of config.xml does not match the platforms files. The current behavior is either confusing (not related) error or no error. In some cases you can detect an issue when trying to run the app. (instant crashes). It's annoying. ...
Spontaneous solution: Store the meta data (app id, etc.) in a separate file to detect changes. Remove the related platforms folder before build, when data have been changed. This can be archieved with an own custom build script. (just thinking aloud). Or check the android.json (or another file in platforms) to check the app-id. Or just remove the platforms folder before every build. But that can delay development time. ...
Ideas are welcome. ... We could add a new CLI option to rebuild the platforms files. In best case just related files / folders. But Cordova should detect changes and rebuild the platform automatically. Or is it possible to set different paths for different app-ids? e.g. a CLI option. Set path for the platforms folder.
Same problem here, any news? Only removing android platform and adding it again will change version in AndroidManifest.xml =(
I found the code that cause bug:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest">
<manifest xmlns:tools="http://schemas.android.com/tools" />
</edit-config>
Bug Report
App config.xml does not update AndroidManifest.xml file's versionCode, versionName or anything
Problem
I have changed app version, add some meta-data at android scope in config.xml file but after build it does not update android 'AndroidManifest.xml' file. I still see the previous value and meta-data in 'AndroidManifest.xml'.
What is expected to happen?
changing on app config.xml file [app version, meta-data], should be changed in android 'AndroidManifest.xml' file after build.
What does actually happen?
After changing app config.xml file widget version, meta-data, when the build finished nothing updated in AndroidManifest.xml file. And it shows no error, warning in build console/terminal. Build was success.
Information
Changes on config.xml file data [app widget version], it changes automatically app version for the first couple of builds but after 6-7th time cordova build it does not automatically update. 'AndroidManifest.xml' so my android build version not updating and meta-data not added. Screenshot attached
Command or Code
ionic cordova build android
Environment, Platform, Device
Version information
Checklist