Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Develop for android java issues
QtWS25 Last Chance

Develop for android java issues

Scheduled Pinned Locked Moved Solved General and Desktop
quickandroidmobile
28 Posts 5 Posters 7.4k 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.
  • P Phips04
    13 Oct 2020, 10:22

    This post is deleted!

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 13 Oct 2020, 11:17 last edited by
    #8
    This post is deleted!
    1 Reply Last reply
    0
    • P Offline
      P Offline
      Phips04
      wrote on 13 Oct 2020, 15:25 last edited by
      #9

      @J-Hilk Which file is that?

      Do you mean the *.pro file?

      K 1 Reply Last reply 13 Oct 2020, 15:56
      0
      • P Phips04
        13 Oct 2020, 15:25

        @J-Hilk Which file is that?

        Do you mean the *.pro file?

        K Offline
        K Offline
        KroMignon
        wrote on 13 Oct 2020, 15:56 last edited by
        #10

        @Phips04 said in Develop for android java issues:

        Do you mean the *.pro file?

        No, the Android manifest ==> AndroidManifest.xml
        Double click on it in QtCreator to start the editor:
        11469230-f742-477d-b2a4-dac3c72d3219-image.png

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        1 Reply Last reply
        1
        • P Offline
          P Offline
          Phips04
          wrote on 13 Oct 2020, 18:46 last edited by
          #11

          QTAndroid.jpg

          This is how it actually looks like, the option to set the sdk is disabled.
          I made sure, that the sdk's I want to use are installed. (Sry I'm new to qt)

          K 1 Reply Last reply 13 Oct 2020, 20:05
          0
          • P Phips04
            13 Oct 2020, 18:46

            QTAndroid.jpg

            This is how it actually looks like, the option to set the sdk is disabled.
            I made sure, that the sdk's I want to use are installed. (Sry I'm new to qt)

            K Offline
            K Offline
            KroMignon
            wrote on 13 Oct 2020, 20:05 last edited by
            #12

            @Phips04 Did you check QtCreator Android configuration?

            In Tools/Option/Devices, select tab "Android":
            9acabd97-323f-4a6a-8f1e-36521c90789c-image.png

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Phips04
              wrote on 14 Oct 2020, 15:03 last edited by
              #13

              Java and android settings are ok, in the android settings there is no "ndk-bundle". But the second entry exists, as I mentioned OpenSSL is not set

              K 1 Reply Last reply 14 Oct 2020, 15:37
              0
              • P Phips04
                14 Oct 2020, 15:03

                Java and android settings are ok, in the android settings there is no "ndk-bundle". But the second entry exists, as I mentioned OpenSSL is not set

                K Offline
                K Offline
                KroMignon
                wrote on 14 Oct 2020, 15:37 last edited by
                #14

                @Phips04 said in Develop for android java issues:

                in the android settings there is no "ndk-bundle"

                This is your problem, ndk-bundle is mandatory for Qt!

                Extract from the Qt documentation:
                Use the sdkmanager command line tool to update the packages list and then install the essential packages:

                cd <ANDROID_SDK_ROOT>/tools/bin/
                ./sdkmanager --update
                ./sdkmanager --install "platform-tools" "platforms;android-29" "build-tools;29.0.2" "ndk-bundle"
                

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Phips04
                  wrote on 14 Oct 2020, 17:51 last edited by
                  #15

                  Ok, I did it, but the cmd line reported some errors, and there was no effect in qt creator.
                  QTAndroid2.jpg

                  K 1 Reply Last reply 14 Oct 2020, 20:44
                  0
                  • P Phips04
                    14 Oct 2020, 17:51

                    Ok, I did it, but the cmd line reported some errors, and there was no effect in qt creator.
                    QTAndroid2.jpg

                    K Offline
                    K Offline
                    KroMignon
                    wrote on 14 Oct 2020, 20:44 last edited by
                    #16

                    @Phips04 This seems to be a well know issue with Android:

                    • https://stackoverflow.com/questions/60730615/sdkmanager-warning-could-not-create-setting-java-lang-illegalargumentexcepti
                    • https://medium.com/@s89707192/if-you-have-the-issue-652c7c1ad5d0

                    You can try:

                    cd <ANDROID_SDK_ROOT>\tools\bin\
                    sdkmanager --sdk_root="<ANDROID_SDK_ROOT>" --update
                    sdkmanager --sdk_root="<ANDROID_SDK_ROOT>" --install "platform-tools" "platforms;android-29" "build-tools;29.0.2" "ndk-bundle"
                    

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Phips04
                      wrote on 15 Oct 2020, 06:35 last edited by
                      #17

                      It worked this way, the bundle is installed now, but I still can't change the minimal android version

                      J K 2 Replies Last reply 15 Oct 2020, 06:50
                      0
                      • P Phips04
                        15 Oct 2020, 06:35

                        It worked this way, the bundle is installed now, but I still can't change the minimal android version

                        J Offline
                        J Offline
                        J.Hilk
                        Moderators
                        wrote on 15 Oct 2020, 06:50 last edited by
                        #18

                        @Phips04 do it by hand than, open the android manifest.xml in a text editor
                        and change the version there
                        2fb9ec48-f65e-4d1d-97a4-2689c7454849-image.png


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          Phips04
                          wrote on 15 Oct 2020, 07:36 last edited by
                          #19

                          The .xml can be evaluated and I set the entries. Min sdk is 21 (android 5) and target is 27 (android 8.1). The error still is the same

                          1 Reply Last reply
                          0
                          • P Phips04
                            15 Oct 2020, 06:35

                            It worked this way, the bundle is installed now, but I still can't change the minimal android version

                            K Offline
                            K Offline
                            KroMignon
                            wrote on 15 Oct 2020, 07:41 last edited by
                            #20

                            @Phips04 said in Develop for android java issues:

                            It worked this way, the bundle is installed now, but I still can't change the minimal android version

                            What do you mean with "you can't"? Is the dropdown combobox grayed out or is the list empty?
                            Do you have restart Qt Creator after updating SDK root?

                            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                            1 Reply Last reply
                            0
                            • P Offline
                              P Offline
                              Phips04
                              wrote on 15 Oct 2020, 07:48 last edited by
                              #21

                              Yes the combobox was grayed (I set the entries in the xml file via text editor, now I can edit the boxes) and I restarted Qt creator.

                              K 1 Reply Last reply 15 Oct 2020, 08:10
                              0
                              • P Phips04
                                15 Oct 2020, 07:48

                                Yes the combobox was grayed (I set the entries in the xml file via text editor, now I can edit the boxes) and I restarted Qt creator.

                                K Offline
                                K Offline
                                KroMignon
                                wrote on 15 Oct 2020, 08:10 last edited by KroMignon
                                #22

                                @Phips04 I know how have written "Java settings are ok", but which JDK version are you using?

                                AFAIK, gradle do NOT work with JDK > 11, and recommended version is still JDK 8.

                                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                1 Reply Last reply
                                0
                                • P Offline
                                  P Offline
                                  Phips04
                                  wrote on 15 Oct 2020, 08:49 last edited by
                                  #23

                                  I meant qt Creator says Java settings are ok.
                                  I didn't remember that version 8 is the recommended one, installed 15.
                                  I will replace it by 8 now

                                  K 1 Reply Last reply 15 Oct 2020, 09:05
                                  0
                                  • P Phips04
                                    15 Oct 2020, 08:49

                                    I meant qt Creator says Java settings are ok.
                                    I didn't remember that version 8 is the recommended one, installed 15.
                                    I will replace it by 8 now

                                    K Offline
                                    K Offline
                                    KroMignon
                                    wrote on 15 Oct 2020, 09:05 last edited by KroMignon
                                    #24

                                    @Phips04 said in Develop for android java issues:

                                    I didn't remember that version 8 is the recommended one, installed 15.

                                    Yes, it is no clearly defined ==> https://doc.qt.io/qt-5/android-building.html.
                                    JDK 8, still recommended for best compatibility, but starting with Qt 5.15 JDK 11 could be used.

                                    Side note: if you search on internet java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7, all matches you will found will clearly detail the issue. The gradle version is not compatible with the selected JDK.
                                    For Qt 5.15, the used gradle version is 5.6.4 (just check in <QT_DIR>/5.15.0/android/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties)

                                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                    1 Reply Last reply
                                    2
                                    • P Offline
                                      P Offline
                                      Phips04
                                      wrote on 15 Oct 2020, 15:20 last edited by
                                      #25

                                      Ok, now finally it works. This is my very basic UI for testing

                                      QTAndroid4.jpg

                                      This is the sourcecode:

                                      import QtQuick 2.15
                                      import QtQuick.Window 2.15

                                      Window {
                                      Rectangle {
                                      id: rectangle
                                      color: "#09a4cc"
                                      anchors.fill: parent

                                          Rectangle {
                                              id: rectangle1
                                              x: 220
                                              y: 117
                                              width: 200
                                              height: 200
                                              color: "#4facfe"
                                              radius: height / 2
                                              gradient: Gradient {
                                                  GradientStop {
                                                      position: 0
                                                      color: "#4facfe"
                                                  }
                                      
                                                  GradientStop {
                                                      position: 1
                                                      color: "#00f2fe"
                                                  }
                                              }
                                          }
                                      }
                                      

                                      }

                                      What it shows is simply a white screen.πŸ™„

                                      K 1 Reply Last reply 15 Oct 2020, 15:46
                                      1
                                      • P Phips04
                                        15 Oct 2020, 15:20

                                        Ok, now finally it works. This is my very basic UI for testing

                                        QTAndroid4.jpg

                                        This is the sourcecode:

                                        import QtQuick 2.15
                                        import QtQuick.Window 2.15

                                        Window {
                                        Rectangle {
                                        id: rectangle
                                        color: "#09a4cc"
                                        anchors.fill: parent

                                            Rectangle {
                                                id: rectangle1
                                                x: 220
                                                y: 117
                                                width: 200
                                                height: 200
                                                color: "#4facfe"
                                                radius: height / 2
                                                gradient: Gradient {
                                                    GradientStop {
                                                        position: 0
                                                        color: "#4facfe"
                                                    }
                                        
                                                    GradientStop {
                                                        position: 1
                                                        color: "#00f2fe"
                                                    }
                                                }
                                            }
                                        }
                                        

                                        }

                                        What it shows is simply a white screen.πŸ™„

                                        K Offline
                                        K Offline
                                        KroMignon
                                        wrote on 15 Oct 2020, 15:46 last edited by
                                        #26

                                        @Phips04 I think you have to set property visible to true of top Window:

                                        import QtQuick 2.15
                                        import QtQuick.Window 2.15
                                        
                                        Window {
                                            visible: true // ==> default value is false!
                                            Rectangle {
                                                id: rectangle
                                                color: "#09a4cc"
                                                anchors.fill: parent
                                              ...
                                           }
                                        }
                                        

                                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                        1 Reply Last reply
                                        1
                                        • P Offline
                                          P Offline
                                          Phips04
                                          wrote on 15 Oct 2020, 18:52 last edited by Phips04
                                          #27

                                          Ok, QT creator does not recongnize the property, but it compiles, and now it works the way it should,
                                          thanks for your helpπŸ‘

                                          K 1 Reply Last reply 16 Oct 2020, 05:27
                                          1

                                          17/28

                                          15 Oct 2020, 06:35

                                          • Login

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