Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): can't set versionCode in manifest as of 9.0.0 #11416

Merged
merged 2 commits into from Jan 17, 2020

Conversation

jquick-axway
Copy link
Contributor

JIRA:
https://jira.appcelerator.org/browse/TIMOB-27705

Note 1:
This issue was never in a release version. Was caught before release.
Regression caused by changing build system from "ant" to "gradle".

Note 2:
Android gradle build system ignores "versionCode" and "versionName" set in "AndroidManfiest.xml". This is by Google's design. You are expected to set these settings in the "build.gradle" file instead. This PR maintains backward compatibility by reading these 2 version settings in the "tiapp.xml" and "./platform/android/AndroidManifest.xml" and writing them to the generated "build.gradle" file.

Note 3:
Titanium app developer can also set "versionCode" and "versionName" via their own "./platform/android/build.gradle" file. This will take priority over the Titanium generated "build.gradle" file.


Test:

  1. Create a "Classic" 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. Verify android:versionCode is set to 5.
  7. Copy the below "build.gradle" content to project folder ./platform/android.
  8. Build for Android.
  9. Go to folder: ./build/android/app/build/intermediates/merged_manifests/debug
  10. Verify "AndroidManifest.xml" file's android:versionCode is set to 7.

tiapp.xml

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

./platform/android/build.gradle

android {
	defaultConfig {
		versionCode 7
	}
}

- Regression caused by changing build system from ant to gradle.
- Now reads versionCode from "AndroidManifest.xml" and writes it to generated "build.gradle" file.
@build
Copy link
Contributor

build commented Jan 8, 2020

Messages
📖

💾 Here's the generated SDK zipfile.

📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖

✅ All tests are passing
Nice one! All 6550 tests are passing.
(There are 700 skipped tests not included in that total)

Generated by 🚫 dangerJS against 04283b4

@lokeshchdhry
Copy link
Contributor

FR Passed.

Studio Ver: 5.1.4.201909061933
SDK Ver: 9.0.0 local build
OS Ver: 10.14.5
Xcode Ver: Xcode 11.3
Appc NPM: 4.2.15
Appc CLI: 7.1.2
Daemon Ver: 1.1.3
Ti CLI Ver: 5.2.2
Alloy Ver: 1.14.4
Node Ver: 12.13.1
NPM Ver: 6.12.1
Java Ver: 11.0.1
Android Devices: ⇨ google Pixel (Android 10)

@lokeshchdhry lokeshchdhry merged commit a69f6b6 into tidev:master Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants