Android sdk and java 8 - or java 11 - or ?
-
Greetings,
I'm trying to get an application running on mobile, specifically on Android for the time being (I have never developed a mobile app).
I've decided to try the little calculator demo project that comes with qt creator (version 7.0.2 based on Qt 6.2.3, clang 13.0 Apple, 64bit).
The calculator demo runs fine on macos. I'm trying to run it on an Android Qt 6.3.1 Clang x86 emulator.
Trying to build the projects, I get the following errors:
FAILURE: Build failed with an exception. * Where: Build file '/Applications/qt/Examples/Qt-6.3.1/widgets/widgets/build-calculator-Android_Qt_6_3_1_Clang_x86-Debug/android-build/build.gradle' line: 17 * What went wrong: A problem occurred evaluating root project 'android-build'. > Failed to apply plugin 'com.android.internal.application'. > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing `org.gradle.java.home` in `gradle.properties`. * Try: > 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. * Get more help at https://help.gradle.org BUILD FAILED in 8s Building the android package failed!
Right... so let's try to use Java 11 to run. Or should I ? In the Devices settings, I see the following:
So - On the one hand, java 1.8 is required, but java 11 is required to run.
I'm confused as to what needs to be changed.
Help !😉
-
@ChrisW67 Hello,
Thanks for the reply; I have a couple of questions:
-
How do I find out what version(s) of the SDK do I have ?
-
How do you know that Version 34 is the current version ? I don't see that in the error messages.
I searched my disk for "sdkmanager", and found 3 different versions. All of them give the following error message when I try running them thusly:
sdkmanager --verbose --version Error: LinkageError occurred while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerCli java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Thank you very much for your help and suggestions !
-
-
@oin-oin
Check here out.
https://forum.qt.io/topic/151244/online-installed-android-qt-6-6-but-build-requires-newer-version/6?_=169868718474934 is the latest for Android 14. Better to know your target Android version(14, 13, 12, or 11...) first.