Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27705] Android: Can't set versionCode via AndroidManifest.xml as of 9.0.0

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2020-01-22T14:31:59.000+0000
Affected Version/sRelease 9.0.0
Fix Version/sRelease 9.0.0
ComponentsAndroid
Labelsandroid, android-manifest, engSchedule, manifest, regression, version
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-01-07T04:21:11.000+0000
Updated2020-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:*

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
	}
}

Comments

  1. Joshua Quick 2020-01-08

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11416
  2. Lokesh Choudhary 2020-01-17

    FR Passed. waiting for CR & jenkins.
  3. Samir Mohammed 2020-01-22

    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

JSON Source