Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67223

Changing pre-compiled jar for android project causes "Unable to instantiate application" error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.10.1
    • QPA
    • Android

    Description

       

      In an android application with a custom manifest, if you have a library file in a "libs" subdirectory then compiling and testing works fine until that library is updated, after the library is updated the application will no longer run at all and will crash instantly at startup with the following debug output:

      I art     : Late-enabling -Xcheck:jni
      D AndroidRuntime: Shutting down VM
      E AndroidRuntime: FATAL EXCEPTION: main
      E AndroidRuntime: Process: org.qtc.qttestapp, PID: 13124
      E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application org.qtproject.qt5.android.bindings.QtApplication: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/org.qtc.qttestapp-2/base.apk"],nativeLibraryDirectories=[/data/app/org.qtc.qttestapp-2/lib/arm, /data/app/org.qtc.qttestapp-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
      E AndroidRuntime:     at android.app.LoadedApk.makeApplication(LoadedApk.java:578)
      E AndroidRuntime:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)
      E AndroidRuntime:     at android.app.ActivityThread.-wrap1(ActivityThread.java)
      E AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
      E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
      E AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
      E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
      E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
      E AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
      E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/org.qtc.qttestapp-2/base.apk"],nativeLibraryDirectories=[/data/app/org.qtc.qttestapp-2/lib/arm, /data/app/org.qtc.qttestapp-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
      E AndroidRuntime:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      E AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
      E AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
      E AndroidRuntime:     at android.app.Instrumentation.newApplication(Instrumentation.java:981)
      E AndroidRuntime:     at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
      E AndroidRuntime:     ... 9 more
      E AndroidRuntime:     Suppressed: java.lang.ClassNotFoundException: org.qtproject.qt5.android.bindings.QtApplication
      E AndroidRuntime:         at java.lang.Class.classForName(Native Method)
      E AndroidRuntime:         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
      E AndroidRuntime:         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
      E AndroidRuntime:         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
      E AndroidRuntime:         ... 12 more
      E AndroidRuntime:     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
      

      The only way to workaround this issue seems to be (this must be done after the failed execution) generate a new android manifest file from the run tab and to change the application identifier (just changing the existing manifest file data is not sufficient). After doing this workaround, the application will start fine, but as development involves changing the library, this is extending the time required to perform any testing.

       

      Attachments

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            thedjnk Mr nK
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: