[TIMOB-27850] Android: App/Module builds fail with JDK 14 as of 9.0.0
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2020-05-04T23:52:00.000+0000 |
| Affected Version/s | Release 9.0.0 |
| Fix Version/s | Release 9.0.2 |
| Components | Android |
| Labels | android, build, gradle, jdk |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2020-04-16T01:04:57.000+0000 |
| Updated | 2020-05-04T23:52:00.000+0000 |
Description
*Summary:*
When building an app or module with Titanium 9.0.0, the build will fail if JDK 14 is installed.
Titanium 8.3.x builds fine with JDK 14... except for Hyperloop builds: [TIMOB-27780]
*Steps to reproduce:*
Install JDK 14.
Create a Titanium app project.
Build with Titanium 9.0.1 for Android. (9.0.1 supports JDK 13.)
*Result:*
[ERROR] [GRADLE]
[ERROR] [GRADLE] FAILURE: Build failed with an exception.
[ERROR] [GRADLE]
[ERROR] [GRADLE] * What went wrong:
[ERROR] [GRADLE] Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
[ERROR] [GRADLE]
[ERROR] [GRADLE] * Try:
[ERROR] [GRADLE] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[ERROR] [GRADLE]
[ERROR] [GRADLE] * Get more help at https://help.gradle.org
[ERROR] [GRADLE]
[ERROR] [GRADLE] BUILD FAILED in 597ms
[ERROR] "gradlew" tool returned exit code: 1
*Cause:*
As of Titanium 9.0.0, we now build with gradle.
We need to upgrade gradle to v6.3.0 which recently added JDK 14 support.
https://docs.gradle.org/6.3/release-notes.html
*To-Do:*
In folder titanium_mobile/android, execute below command line to upgrade gradle wrapper files.
./gradlew wrapper --distribution-type all --gradle-version 6.3
We should also update our com.android.tools.build:gradle tool to version 3.6.2 for files...
https://github.com/appcelerator/titanium_mobile/blob/master/android/build.gradle
https://github.com/appcelerator/titanium_mobile/blob/master/android/templates/build/root.build.gradle
*Note:*
You can have multiple JDK installations on Mac. You can list the JDK versions installed by entering the following at the command line.
/usr/libexec/java_home -V
You can select which installed JDK version to use by entering the following at the command line. You'll need to set the <JavaVersion> to what's installed, which the above command line will list. The below can be set in your .bash_profile file.
export JAVA_HOME=$(/usr/libexec/java_home -v <JavaVersion>)
*Work-Around:*
Downgrade to JDK 13 for Titanium 9.0.1.
Downgrade to JDK 12 for Titanium 9.0.0. (See [TIMOB-27781])
(JDK 8 is the min version needed.)
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11636 PR (9.0.x): https://github.com/appcelerator/titanium_mobile/pull/11637
FR Passed. App and module builds fine with different java versions(11,13,14)
Waiting for Jenkins build on master.
merged to master
Verified on: Mac OS: 10.15.4 SDK: 9.0.2.v20200504063604, 9.1.0.v20200504090422 Appc CLI: 8.0.0 JDK: 11.0.6, 13.0.2, 14.0.1 Node: 10.17.0 Device: Pixel3(v10.0) emulator