Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27705

Android: Can't set versionCode via AndroidManifest.xml as of 9.0.0

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 2

      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:

      1. Create a Titanium app project.
      2. Set up the "tiapp.xml" file with the below.
      3. Build for Android.
      4. Go to folder: ./build/android/app/build/intermediates/merged_manifests/debug
      5. Open the "AndroidManfiest.xml" file.
      6. 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
      	}
      }
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Lokesh Choudhary
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration