Can't build Anroid app with 5.9.1



  • Hi,

    I am new to Qt, so if there is something I mess up please forgive me.

    What I have is Qt creator 4.3.1, Qt 5.9.1, have toolkit setup as the figure:

    0_1506931373021_67b593cd-7ac6-4e70-b9d4-b0bb4ce2965e-image.png

    My first question is , why the "Android build SDK" has a null droplist.
    You can see as the following:

    0_1506930783663_08a702bf-86db-479a-a6f6-66e067cd2372-image.png

    I ask this, because during building, there is a "warning: Android platform 'android--1' does not exist in SDK", somebody said to work through it by selecting this "Android build SDK".

    My second question is : build a simple app, it failed at the last steps. (From the above figure you can see I also tried to create a selfsigned certificate for it but no luck)

    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.ssl.Alerts.getSSLException(java.base@9-internal/Alerts.java:198)
    at sun.security.ssl.SSLSocketImpl.fatal(java.base@9-internal/SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:309)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:303)
    at sun.security.ssl.ClientHandshaker.checkServerCerts(java.base@9-internal/ClientHandshaker.java:1841)
    ...........

    I have searched by Google bu could not find any useful workaround.

    Thanks for your help!


  • Moderators

    @ajee said in Can't build Anroid app with 5.9.1:

    My first question is , why the "Android build SDK" has a null droplist

    this is a known issue (QTCREATORBUG-18962, and some others) and will be fixed with QtCreator 4.5 (so this might take a while until the next release)

    A workaround is to downgrade the SDK tools to manually 25.x.x (see this)

    My second question is : build a simple app, it failed at the last steps. (From the above figure you can see I also tried to create a selfsigned certificate for it but no luck)

    The issue from question 1 is essential. So i guess this is just a follow up issue. Since you end up using a wrong android SDK after all.



  • @raven-worx Following the reply above, I have tried as modifying to
    <value type="QString" key="BuildTargetSdk">android-26</value>
    It can workaround the warning "warning: Android platform 'android--1' does not exist in SDK".

    But the second one, still exists no matter I try android-26, android-25 and android-24, So I don't think it is related to the first question? Just another snapshot to show I have older SDK installed and play with them as said. Do you need any further log from me to troubleshooting? Just wonder only me seeing this ?

    0_1506942202303_825fd132-69cf-4c1f-86a0-4492a2068b83-image.png


  • Moderators

    @ajee said in Can't build Anroid app with 5.9.1:

    Following the reply above, I have tried as modifying to
    <value type="QString" key="BuildTargetSdk">android-26</value>
    It can workaround the warning "warning: Android platform 'android--1' does not exist in SDK".

    but you should download the tools from the links and replace the tools folder in your SDK folder.
    I am not 100% sure if something else still breaks in the back.

    That definitely works, since i've tried it myself already.

    What are you doing in your simple app causing the exception?



  • Hi,

    I rename the tools under Android/Sdk to tools_org and then download http://dl-ssl.google.com/android/repository/tools_r25.2.5-linux.zip , unzip and put in under Android/Sdk. Now the Qt creator can show up the droplist for android 24-26 ( which I have downloaded by Android studio).

    But still, the build failed with "Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found", no matter I choose "Sign Package" with my selfsigned cert or not.

    I did nothing special, just download a Qt community installer then install it on my Ubuntu 16.04. Frustrated, is there any docker for Qt latest development environment so that we don't need meet such problems?

    Thanks


  • Moderators

    @ajee said in Can't build Anroid app with 5.9.1:

    But still, the build failed with "Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found", no matter I choose "Sign Package" with my selfsigned cert or not.

    what is your app doing exactly? This rather looks like you are attempting to connect to a SSL (HTTPS?) address somewhere inside your Java code.
    This has nothing todo with signing your app package.



  • @raven-worx Thank you for your reply, I just built one of the examples from Qt itself, named heartrate-game, I don't see any java code for it.

    0_1507018031410_95614044-4931-4319-84b1-2fab8535c512-image.png


  • Moderators

    @raven-worx said in Can't build Anroid app with 5.9.1:

    this is a known issue (QTCREATORBUG-18962, and some others) and will be fixed with QtCreator 4.5 (so this might take a while until the next release)
    A workaround is to downgrade the SDK tools to manually 25.x.x (see this)

    seems like this is now already fixed with QtCreator 4.4.1/Qt5.9.2



  • @ajee said in Can't build Anroid app with 5.9.1:

    @raven-worx Thank you for your reply, I just built one of the examples from Qt itself, named heartrate-game, I don't see any java code for it.

    0_1507018031410_95614044-4931-4319-84b1-2fab8535c512-image.png

    I have the same erorrs (No trusted certificate found) while building heartrate-game from examples or a new QtQuick Controls 2 Application.

    Qt Creator 4.4.1
    Based on Qt 5.9.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
    Built on Oct 4 2017 04:14:10
    From revision 6afdb8bdf9
    

    Using the latest Android Sdk with android-26. FWIW I see similar error messages when I attempt to run sdkmanager --list manually, both from Sdk/tools and the older 25.2.5 tools-

    shantanu@shaan-desktop:~/software/Android/Sdk/tools$ ./bin/sdkmanager --list
    Warning: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    Warning: File /home/shantanu/.android/repositories.cfg could not be loaded.     
    Warning: Failed to download any source lists!                                   
    Installed packages:=====================] 100% Computing updates...             
      Path                        | Version | Description                    | Location                    
      -------                     | ------- | -------                        | -------                     
      build-tools;26.0.2          | 26.0.2  | Android SDK Build-Tools 26.0.2 | build-tools/26.0.2/         
      emulator                    | 26.1.4  | Android Emulator               | emulator/                   
      extras;android;m2repository | 47.0.0  | Android Support Repository     | extras/android/m2repository/
      extras;google;m2repository  | 58      | Google Repository              | extras/google/m2repository/ 
      patcher;v4                  | 1       | SDK Patch Applier v4           | patcher/v4/                 
      platform-tools              | 26.0.1  | Android SDK Platform-Tools     | platform-tools/             
      platforms;android-26        | 2       | Android SDK Platform 26        | platforms/android-26/       
      sources;android-26          | 1       | Sources for Android 26         | sources/android-26/         
      tools                       | 26.1.1  | Android SDK Tools              | tools/
    
    shantanu@shaan-desktop:~/software/android/tools$ ./bin/sdkmanager --list
    Warning: File /home/shantanu/.android/repositories.cfg could not be loaded.
    Warning: Failed to download any source lists!
    Warning: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    Installed packages:
      Path  | Version | Description              | Location
      ------- | ------- | -------                  | ------- 
      tools | 25.2.5  | Android SDK Tools 25.2.5 | tools/ 
    

    But when I run Android Studio, its able to install packages fine :/



  • Found it, was a PEBKAC. My Ubuntu only had openjdk-8-jre installed, I had to also install openjdk-8-jdk



  • @shaan7 Hi, I notice that my difference from you is that the JDK localtion in Projects-> Manage Kits... -> Devices -> Android is pointing to /usr/lib/jvm/java-9-openjdk-amd64. So as you said, I switch it to java-8-openjdk-amd64. I also check the corresponding jre installed. But still no luck, while the error msg changed to

    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.