Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23826] Android: Build fails using build tools higher than 24.0 and Java 1.7

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-08-14T11:52:30.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.2.0
ComponentsAndroid, CLI, Tooling
Labelsqe-6.0.0
ReporterEwan Harris
AssigneeGary Mathews
Created2016-08-25T18:42:52.000+0000
Updated2017-08-25T09:55:27.000+0000

Description

Description

When building with Android SDK Build-tools > 24.0 and Java < 1.8 the dexer step in the build process bombs out with the below, these build tools seem to require 1.8 [link](http://stackoverflow.com/questions/39116095/android-studio-buildtools-24-0-1-requires-java-1-8-or-above)
[ERROR] Failed to run dexer:
[ERROR]
[ERROR] java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
[ERROR]         at java.lang.ClassLoader.defineClass1(Native Method)
[ERROR]         at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[ERROR]         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[ERROR]         at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[ERROR]         at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[ERROR]         at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[ERROR]         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[ERROR]         at java.security.AccessController.doPrivileged(Native Method)
[ERROR]         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[ERROR]         at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[ERROR]         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[ERROR]         at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[ERROR]         at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
[ERROR] Exception in thread "main"
*WORKAROUND* Install Java 1.8

Steps to reproduce

Install Android SDK Build-tools > 24.0 and a Java version < 1.7

Build for Android

Actual result

Build will fail with the error above

Expected result

Some help for the user in clarifying what's wrong

Comments

  1. Chee Kiat Ng 2016-08-26

    [~eharris] I believe 24 is used for Android N, and I think we haven't announced support for build tools 24. Can you verify if you face the same issue on mac? I'll plan this accordingly for the titanium SDK release that supports Android N.
  2. Ashraf Abu 2016-08-26

    If I'm not wrong, we just need to upgrade the java to 1.8 and need not do anything else. In the future though, we might need to change our toolchain for building android using Jack. https://developer.android.com/guide/platform/j8-jack.html In the mean time, it's not needed.
  3. Ewan Harris 2016-08-26

    [~cng] Yes this happens on mac also.
  4. Chris Barber 2017-04-07

    I'm not certain this is an issue once TIMOB-24555 is merged. I have been able to successfully build an Android app using build tools 25 + platform tools 25 + android tools 26 + android sdk 25 (7.1.1) using TIMOB-24555. Once TIMOB-24555 is merged, we can re-test this and see if it's still valid.
  5. Carlos Henrique Zinato 2017-06-28

    For those having this problem, you can find the latest JDK here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  6. Gary Mathews 2017-08-14

    [#PR-9274](https://github.com/appcelerator/titanium_mobile/pull/9274) will change our versioning to require build-tools 26.0 and JDK 1.8
  7. Ewan Harris 2017-08-25

    Verified in 6.2.0.v20170824144806 and 7.0.0.v20170823165814 When using Java 1.7 in SDK 6.2.0, when building for Android the CLI (appc and ti) will error out with the error below
       appc run -p android -T device --build-only
       Appcelerator Command-Line Interface, version 6.2.2
       Copyright (c) 2014-2017, Appcelerator, Inc.  All Rights Reserved.
       
       [ERROR] JDK version 1.7.0 detected, but only version >=1.8.x is supported
       

JSON Source