Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Android sdk and java 8 - or java 11 - or ?
QtWS25 Last Chance

Android sdk and java 8 - or java 11 - or ?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oin-oin
    wrote on 28 Oct 2023, 15:55 last edited by oin-oin
    #1

    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:Screenshot 2023-10-28 at 17.52.31.png

    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 !😉

    C 1 Reply Last reply 30 Oct 2023, 03:49
    0
    • O oin-oin
      28 Oct 2023, 15:55

      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:Screenshot 2023-10-28 at 17.52.31.png

      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 !😉

      C Offline
      C Offline
      ChrisW67
      wrote on 30 Oct 2023, 03:49 last edited by
      #2

      @oin-oin What version of the SDK Tools do have installed? The first fail message indicates version 26 and earlier have the Java 1.8 dependency. Version 34 looks to be the current version

      O 1 Reply Last reply 30 Oct 2023, 17:49
      0
      • C ChrisW67
        30 Oct 2023, 03:49

        @oin-oin What version of the SDK Tools do have installed? The first fail message indicates version 26 and earlier have the Java 1.8 dependency. Version 34 looks to be the current version

        O Offline
        O Offline
        oin-oin
        wrote on 30 Oct 2023, 17:49 last edited by
        #3

        @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 !

        J 1 Reply Last reply 30 Oct 2023, 18:11
        0
        • O oin-oin
          30 Oct 2023, 17:49

          @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 !

          J Offline
          J Offline
          JoeCFD
          wrote on 30 Oct 2023, 18:11 last edited by
          #4

          @oin-oin
          Check here out.
          https://forum.qt.io/topic/151244/online-installed-android-qt-6-6-but-build-requires-newer-version/6?_=1698687184749

          34 is the latest for Android 14. Better to know your target Android version(14, 13, 12, or 11...) first.

          1 Reply Last reply
          0

          4/4

          30 Oct 2023, 18:11

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved