Qt World Summit: Register Today!

[Solved] Unable to run on android using Qt 5.4

  • Hi all

    In short my situation: I have a code that using the old Qt 5.3.2 was able to run into android. Same code, once moved to latest Qt 5.4 ( and latest version of Qt Creator too) doesn't work anymore. I tried all the possible combination but without success. Before report the error please note I'm still using Ant for apk packaging since if I select Gradle the tool attept to download the gradle zip file but I'm through a proxy and the download fail.Currently the target of my app is android-15 but when I execute the following error show up in the console:

    @W/System.err( 1330): java.lang.ClassNotFoundException: android.graphics.drawable.RippleDrawable
    W/System.err( 1330): at java.lang.Class.classForName(Native Method)
    W/System.err( 1330): at java.lang.Class.forName(Class.java:217)
    W/System.err( 1330): at java.lang.Class.forName(Class.java:172)
    W/System.err( 1330): at org.qtproject.qt5.android.ExtractStyle.getClass(ExtractStyle.java:396)
    W/System.err( 1330): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:100)
    W/System.err( 1330): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:438)
    W/System.err( 1330): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 1330): at java.lang.reflect.Method.invoke(Method.java:511)
    W/System.err( 1330): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
    W/System.err( 1330): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
    W/System.err( 1330): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
    W/System.err( 1330): at android.app.Activity.performCreate(Activity.java:4465)
    W/System.err( 1330): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
    W/System.err( 1330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
    W/System.err( 1330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
    W/System.err( 1330): at android.app.ActivityThread.access$600(ActivityThread.java:123)
    W/System.err( 1330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
    W/System.err( 1330): at android.os.Handler.dispatchMessage(Handler.java:99)
    W/System.err( 1330): at android.os.Looper.loop(Looper.java:137)
    W/System.err( 1330): at android.app.ActivityThread.main(ActivityThread.java:4424)
    W/System.err( 1330): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 1330): at java.lang.reflect.Method.invoke(Method.java:511)
    W/System.err( 1330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    W/System.err( 1330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    W/System.err( 1330): at dalvik.system.NativeStart.main(Native Method)
    W/System.err( 1330): Caused by: java.lang.NoClassDefFoundError: android/graphics/drawable/RippleDrawable
    W/System.err( 1330): ... 25 more
    W/System.err( 1330): Caused by: java.lang.ClassNotFoundException: android.graphics.drawable.RippleDrawable
    W/System.err( 1330): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
    W/System.err( 1330): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    W/System.err( 1330): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    W/System.err( 1330): ... 25 more


    the component "RippleDrawable" has been introduced into latest android-21 but is not my target.

    Someone can help?

    Thank you

  • Forget it, I just tested one of the examples provided witht the Qt package and this error was showed same mode but the app start. This mean there is something other making the app crash using version 5.4. Looking for the problem...

  • It seem the problem is here:

    @D/AndroidRuntime( 1569): Shutting down VM
    W/dalvikvm( 1569): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
    E/AndroidRuntime( 1569): FATAL EXCEPTION: main
    E/AndroidRuntime( 1569): java.lang.UnsatisfiedLinkError: Couldn't load : findLibrary returned null
    E/AndroidRuntime( 1569): at java.lang.Runtime.loadLibrary(Runtime.java:365)
    E/AndroidRuntime( 1569): at java.lang.System.loadLibrary(System.java:535)
    E/AndroidRuntime( 1569): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:252)
    E/AndroidRuntime( 1569): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
    E/AndroidRuntime( 1569): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
    E/AndroidRuntime( 1569): at android.app.Activity.performCreate(Activity.java:4465)
    E/AndroidRuntime( 1569): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
    E/AndroidRuntime( 1569): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
    E/AndroidRuntime( 1569): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
    E/AndroidRuntime( 1569): at android.app.ActivityThread.access$600(ActivityThread.java:123)
    E/AndroidRuntime( 1569): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
    E/AndroidRuntime( 1569): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime( 1569): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime( 1569): at android.app.ActivityThread.main(ActivityThread.java:4424)
    E/AndroidRuntime( 1569): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 1569): at java.lang.reflect.Method.invoke(Method.java:511)
    E/AndroidRuntime( 1569): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    E/AndroidRuntime( 1569): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    E/AndroidRuntime( 1569): at dalvik.system.NativeStart.main(Native Method)@

    Try to load a null library?

  • Hi

    Finally found the problem. In the creation of AndroidManifest.xlm file I didn't set any name into Application -> Run field. This have the result to generate the xml with the following settings empty:

    @<meta-data android:name="android.app.lib_name" android:value=""/>@

    and this cause the error (that was not very clear). Here is needed t set the application name to start.

  • HI,
    i have same problem, but your solutions doesn't work for me. My app start only if deploy the libs with "Deploy local Qt Libraries to temponary directory", but if i Bundle the Qt libraries in APK Bundle, i have the error.

  • Hi
    Final .apk file created is basically a rar file. Try to rename extension to .rar and open with some tool like 7zip for check the content. Qt libraries are under "libs" folder, if you don't find it this mean there is some problem in apk packaging.

  • Hi,
    in the lib/armeabi-v7a directory i have all the libs... I don't understant what happen...

  • Hi
    The error you experiment is the same of mine? Please note in my case it seem the android runtime was looking for an "inexistent" library since the library name label was empty.

  • My error:
    W/System.err(10397): java.lang.ClassNotFoundException: android.graphics.drawable.RippleDrawable
    W/System.err(10397): at java.lang.Class.classForName(Native Method)
    W/System.err(10397): at java.lang.Class.forName(Class.java:217)
    W/System.err(10397): at java.lang.Class.forName(Class.java:172)
    W/System.err(10397): at org.qtproject.qt5.android.ExtractStyle.getClass(ExtractStyle.java:396)
    W/System.err(10397): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:100)
    W/System.err(10397): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:438)
    W/System.err(10397): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err(10397): at java.lang.reflect.Method.invoke(Method.java:511)
    W/System.err(10397): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
    W/System.err(10397): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)

    and doesn't found, randomly, same module.

  • As you can read from my first posts here this error (java.lang.ClassNotFoundException: android.graphics.drawable.RippleDrawable) it isn't critical since it happen using standard Qt examples too. Basically RippleDrawableis a class introduced in android 5, in all older version this error came up but the app start equally than is not the problem.

  • The my problem is that doesn't find the library when i deploy the lib in the apk (but if i unzip i see them).

  • ok but from what you deduce the problem is library not found? The error you reported is not connected to your supposition...

  • I have this supposition (maybe i'm wrong) because if i build in other way (deploy in temporary dir) it run

  • Sorry I don't know how to help you. Without additional information is very hard to figure out the problem. Maybe a full reinstallation of all could be a try.

  • I reinstalled, tried also on OSX, nothing on Android. However thanks

Log in to reply