[TIMOB-27705] Android: Can't set versionCode via AndroidManifest.xml as of 9.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-01-22T14:31:59.000+0000 |
Affected Version/s | Release 9.0.0 |
Fix Version/s | Release 9.0.0 |
Components | Android |
Labels | android, android-manifest, engSchedule, manifest, regression, version |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-01-07T04:21:11.000+0000 |
Updated | 2020-01-22T14:31:59.000+0000 |
Description
*Summary:*
As of Titanium 9.0.0, setting the "versionCode" via the "AndroidManifest.xml" file no longer works.
_(This regression was caught before release.)_
*Steps to reproduce:*
Go to folder:
Notice
Create a Titanium app project.
Set up the "tiapp.xml" file with the below.
Build for Android.
Go to folder: ./build/android/app/build/intermediates/merged_manifests/debug
Open the "AndroidManfiest.xml" file.
Notice android:versionCode
attribute is set to "1"
. _(This is the bug.)_
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:versionCode="5"/>
</android>
</ti:app>
*Reason:*
When building with gradle, the "versionCode" and "versionName" attributes are ignored in the "AndroidManifest.xml" file. These settings can only be set via a "build.gradle" file. This is by Google's design.
*Recommended Solution:*
Titanium's build script should read the "versionCode" from the app developer's "AndroidManifest.xml" write it to the Titanium generated "build.gradle" file. This way it will be backward compatible.
*Work-Around:*
Set the "versionCode" via your own "build.gradle" file as shown below.
./platform/android/build.gradle
android {
defaultConfig {
versionCode 5
}
}
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11416
FR Passed. waiting for CR & jenkins.
Closing ticket Fix verified in SDK version 9.0.0.v20200121151830. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11416