Android Compile Error

Hi,

I’ve been unable to compile on Android for a while now as I keep getting compile errors that I don’t understand. Anyone understand what my problem is?

Here’s the error output:

Note: C:\Users…\Export\android\debug\bin\app\src\main\java\org\libsdl\app\SDLActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 247 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.android.dx.command.Main. Program will exit.
Could not find the main class: com.android.dx.command.Main. Program will exit.
Exception in thread "main"
Exception in thread “main”
:app:transformClassesWithDexForRelease FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformClassesWithDexForRelease’.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files (x86)\Java\jdk1.6.0_37\bin\java.exe’’ finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Is it related to method calls with too much data in them. If so then I can fix that. I’ve got a lot of text in some methods that I can put into an xml file instead.

EDIT: I removed all the text and I still got this issue so I don’t really know.

What is the Gradle Daemon?

I am using the Android NDK r13b and current Android SDK tools (I think that our template for Gradle wants version 34.0.1 or something, though)

It looks like you may have Java 6, I am using Java 8, I believe you may need a newer version

Thanks for your quick reply.

I’ve just been sticking with what it says in http://www.openfl.org/learn/docs/advanced-setup/android/

I’ll try updating the NDK and Java 8 and see if that fixes the problem. Should I still be using API 16?

I apologize that the information there is out-of-date

I believe we target Android API 19, but the minimum supported is still very old, 10 I think. We bumped it recently to better support immersive mode on recent Android handsets :slight_smile:

All working fine now I updated everything.

Thanks for your help.