E0200: Android build failed [Mac OS]

I’m clone Hikr project from Fuse’s Github repo, but can’t build the preview in Android device.

I tried find the solution here, not found.

Running Mac OS 10.11.6

Error log:

⇒  fuse preview -t=Android
Fuse 0.24.0 (build 7243)
Build started: FullCompile
Configuring (14.59s)
Compiling syntax tree (18.09s)
Generating code and data (44.15s)
Building Android app
1/2: libhikr.so
2/2: hikr.apk
       [dx] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

BUILD FAILED
/Volumes/HD/Users/Felipe/Library/Android/sdk/tools/ant/build.xml:888: The following error occurred while executing this line:
/Volumes/HD/Users/Felipe/Library/Android/sdk/tools/ant/build.xml:890: The following error occurred while executing this line:
/Volumes/HD/Users/Felipe/Library/Android/sdk/tools/ant/build.xml:902: The following error occurred while executing this line:
/Volumes/HD/Users/Felipe/Library/Android/sdk/tools/ant/build.xml:283: null returned: 1

Total time: 7 seconds
Buildfile: /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 25.2.1
 [checkenv] Installed at /Volumes/HD/Users/Felipe/Library/Android/sdk

-setup:
     [echo] Project Name: hikr
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 24.0.1
     [echo] Resolving Build Target for hikr...
[gettarget] Project Target:   Android 5.0.1
[gettarget] API level:        21
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/bin/rsObj
    [mkdir] Created dir: /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/bin/rsLibs
     [echo] ----------
     [echo] Resolving Dependencies for hikr...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] No changed resources. R.java and Manifest.java untouched.
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 48 source files to /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/bin/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.

-post-compile:

-obfuscate:

-dex:
      [dex] input: /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/bin/classes
      [dex] input: /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/libs/android-support-v4.jar
      [dex] Pre-Dexing /Volumes/HD/Users/Felipe/MyApps/hikr/build/Android/Preview/hikr/app/src/main/libs/android-support-v4.jar -> android-support-v4-13c73e995aaa8803d59b0a15d5a4b4fe.jar
       [dx]        at java.lang.ClassLoader.defineClass1(Native Method)
       [dx]        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
       [dx]        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
       [dx]        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
       [dx]        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
       [dx]        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
       [dx]        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
       [dx]        at java.security.AccessController.doPrivileged(Native Method)
       [dx]        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
       [dx]        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
       [dx]        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
       [dx]        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
       [dx]        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
(unknown): E0200: Android build failed
?: Error E0200: Android build failed
(10.14s)

Build completed in 87.00 seconds
    1 error
Checking if JDK is corrupt
jdk was found.
Checking if /Volumes/HD/Users/Felipe/Library/Android/sdk exists.
/Volumes/HD/Users/Felipe/Library/Android/sdk was found.
Checking if /Volumes/HD/Users/Felipe/Library/Android/sdk/tools exists.
/Volumes/HD/Users/Felipe/Library/Android/sdk/tools was found.
Checking if Android SDK is corrupt.
androidsdk was found.
Checking if all required Android components are installed.
androidsdkpackages was found.
Checking if /Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/toolchains exists.
/Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/toolchains was found.
Checking if /Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/prebuilt exists.
/Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/prebuilt was found.
androidndk was found.
Checking if /Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/Ant exists.
/Volumes/HD/Users/Felipe/Library/Application Support/Fusetools/Fuse/Android/Ant was found.
Checking if Ant is corrupt
ant was found.
Build ended
fuse: Failed to compile project

The line “[dx] Exception in thread “main” java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0” should give a clue. I wonder if this means that your JDK or Android SDK is out of date. Try running “fuse install android” to get this fixed.

Erik Faye-Lund wrote:

The line “[dx] Exception in thread “main” java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0” should give a clue. I wonder if this means that your JDK or Android SDK is out of date. Try running “fuse install android” to get this fixed.

I found the solution in Terminal, type:

android

The Android SDK Manager will open

Downgrade the Android SDK Build Tools 24 or 24.0.1 to 23.0.3

Now, the build works!

> **Felipe Carvalho wrote:** > >

Erik Faye-Lund wrote:

The line “[dx] Exception in thread “main” java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0” should give a clue. I wonder if this means that your JDK or Android SDK is out of date. Try running “fuse install android” to get this fixed.

I found the solution in Terminal, type:

android

The Android SDK Manager will open

Downgrade the Android SDK Build Tools 24 or 24.0.1 to 23.0.3

Now, the build works!

> I am on Windows 10, but I found this post I had installed Android Studio prior to running `fuse install android`. I found 2 issues. 1. The JAVA_HOME was pointing at the jdk bin folder rather than the jdk folder; this may not be an issue. However, in the output after the fuse android “build for preview” failed, fuse tries to look for bin/bin for javac.exe. 2. At the time of writing this the build tools installed were at version 25. I followed the advice above and uninstalled those and installed the most recent version of 23. This solved the issue for me. I’m a total newb to Android so I could probably have simply chosen the build tools version somewhere. Thanks for the tips Felipe, much appreciated.