Qt for android 5.1.1 to develop an opengl application error



  • When I am using qt for android 5.1.1 to develop an opengl application on the android, I encountered a problem. Help me!

    I just add a QGLWidget into the MainWindow.

    the application output :

    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/lib/libgnustl_shared.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/lib/libgnustl_shared.so 0xb1d67f78
    D/dalvikvm( 4433): No JNI_OnLoad found in /data/data/org.qtproject.example.test4/lib/libgnustl_shared.so 0xb1d67f78, skipping init
    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/lib/libQt5Core.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/lib/libQt5Core.so 0xb1d67f78
    D/dalvikvm( 4433): No JNI_OnLoad found in /data/data/org.qtproject.example.test4/lib/libQt5Core.so 0xb1d67f78, skipping init
    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/lib/libQt5Gui.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/lib/libQt5Gui.so 0xb1d67f78
    D/dalvikvm( 4433): No JNI_OnLoad found in /data/data/org.qtproject.example.test4/lib/libQt5Gui.so 0xb1d67f78, skipping init
    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/lib/libQt5Widgets.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/lib/libQt5Widgets.so 0xb1d67f78
    D/dalvikvm( 4433): No JNI_OnLoad found in /data/data/org.qtproject.example.test4/lib/libQt5Widgets.so 0xb1d67f78, skipping init
    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/lib/libQt5OpenGL.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/lib/libQt5OpenGL.so 0xb1d67f78
    D/dalvikvm( 4433): No JNI_OnLoad found in /data/data/org.qtproject.example.test4/lib/libQt5OpenGL.so 0xb1d67f78, skipping init
    D/dalvikvm( 4433): Trying to load lib /data/data/org.qtproject.example.test4/plugins/platforms/android/libqtforandroidGL.so 0xb1d67f78
    D/dalvikvm( 4433): Added shared lib /data/data/org.qtproject.example.test4/plugins/platforms/android/libqtforandroidGL.so 0xb1d67f78
    I/Qt ( 4433): qt start
    F/Qt ( 4433): Can't find method "mNativeSurfaceI"
    F/Qt ( 4433): registerNatives failed
    W/System.err( 4433): java.lang.reflect.InvocationTargetException
    W/System.err( 4433): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 4433): at java.lang.reflect.Method.invoke(Method.java:515)
    W/System.err( 4433): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:200)
    W/System.err( 4433): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:484)
    W/System.err( 4433): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:688)
    W/System.err( 4433): at android.app.Activity.performCreate(Activity.java:5243)
    W/System.err( 4433): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
    W/System.err( 4433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
    W/System.err( 4433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
    W/System.err( 4433): at android.app.ActivityThread.access$700(ActivityThread.java:135)
    W/System.err( 4433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
    W/System.err( 4433): at android.os.Handler.dispatchMessage(Handler.java:102)
    W/System.err( 4433): at android.os.Looper.loop(Looper.java:137)
    W/System.err( 4433): at android.app.ActivityThread.main(ActivityThread.java:4998)
    W/System.err( 4433): at java.lang.reflect.Method.invokeNative(Native Method)
    W/System.err( 4433): at java.lang.reflect.Method.invoke(Method.java:515)
    W/System.err( 4433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
    W/System.err( 4433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
    W/System.err( 4433): at dalvik.system.NativeStart.main(Native Method)
    W/System.err( 4433): Caused by: java.lang.NoSuchFieldError: no field with name='mNativeSurface' signature='I' in class Landroid/view/Surface;
    W/System.err( 4433): at java.lang.Runtime.nativeLoad(Native Method)
    W/System.err( 4433): at java.lang.Runtime.doLoad(Runtime.java:421)
    W/System.err( 4433): at java.lang.Runtime.load(Runtime.java:331)
    W/System.err( 4433): at java.lang.System.load(System.java:512)
    W/System.err( 4433): at org.qtproject.qt5.android.QtNative.loadQtLibraries(QtNative.java:128)
    W/System.err( 4433): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:322)
    W/System.err( 4433): ... 19 more
    D/dalvikvm( 4433): GC_FOR_ALLOC freed 151K, 7% free 3074K/3292K, paused 35ms, total 35ms
    I/dalvikvm-heap( 4433): Grow heap (frag case) to 4.138MB for 1127536-byte allocation
    D/dalvikvm( 4433): GC_CONCURRENT freed <1K, 6% free 4174K/4396K, paused 98ms+3ms, total 159ms
    D/dalvikvm( 4433): WAIT_FOR_CONCURRENT_GC blocked 62ms
    D/dalvikvm( 4433): GC_CONCURRENT freed 9K, 4% free 4562K/4752K, paused 84ms+2ms, total 142ms
    D/dalvikvm( 4433): WAIT_FOR_CONCURRENT_GC blocked 5ms
    D/ ( 4433): HostConnection::get() New Host Connection established 0xb74d0d48, tid 4433



  • Now, I am trying to run the example application "cube" which include QGLWidget in the qt-creator (qt for android 5.2.0 ) on the android, unforturnately, I had got the same error. Is there anyone who can help me?



  • I'm having the same problem on a Nexus 5 device. What version of Android are you testing on?



  • Finally, I found a post about the opengl on the android. It may help us.
    http://www.kdab.com/qt-on-android-episode-1/



  • The problem is that my application runs on all other devices that I've tested on but it won't start on the Nexus 5. I get the same error as you: Can’t find method “mNativeSurfaceI”. I was thinking that perhaps something changed with KitKat; maybe there's some other permission that needs to be set in order to run native code.



  • Yes, maybe yor are right. I will work further. And tell me if you solved the problem.



  • I also get the same error on the Android 4.4 emulator image but not other emulator versions (4.3, 2.3.3). I filed this bug report:
    https://bugreports.qt-project.org/browse/QTBUG-34734


Log in to reply
 

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