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

Android Qt 5.14.0-beta3: AAPT: error: resource array/bundled_in_lib not found



    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Won't Do
    • Affects Version/s: 5.14.0 Beta3
    • Fix Version/s: None
    • Component/s: Extras: Android
    • Labels:
    • Environment:
      Ubuntu 18.04, gcc 7.4.0, NDK20, QtC 4.11.0-beta1, A-SDK 27,28,29
    • Platform/s:


      With Qt 5.14.0-beta3 I cannot package previously working projects anymore for Android (any arch).

      The manifest has metadata tags in it as seen at e.g. this project: https://github.com/qt-labs/weather-app/blob/master/android/AndroidManifest.xml#L16 , which is also used in all of my existing Qt projects for Android.

      <meta-data android:resource="@array/bundled_in_lib" android:name="android.app.bundled_in_lib_resource_id"/>
      <meta-data android:resource="@array/bundled_in_assets" android:name="android.app.bundled_in_assets_resource_id"/> 

      I can compile the native C++/Qt part, but when reaching the point where gradle/java starts (androiddeployqt), I find these errors:

      /home/gregor/aaDev/me/projects/appdemos/messaging/build-android/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml:87: AAPT: error: resource array/bundled_in_assets (aka net.me.demos.apps.messaging:array/bundled_in_assets) not found.
       <meta-data android:resource="@array/bundled_in_assets" android:name="android.app.bundled_in_assets_resource_id"/>
      AndroidManifest.xml:84: AAPT: error: resource array/bundled_in_lib (aka net.me.demos.apps.messaging:array/bundled_in_lib) not found.

      So temporary removed those two lines so build can go on.
      When inspecting the generated R.java file, indeed those two arrays are missing now, but were always present in previous Qt versions. 

        public static final class array {
          public static final int bundled_libs=0x7f020000;
          public static final int load_local_libs=0x7f020001;
          public static final int qt_libs=0x7f020002;
          public static final int qt_sources=0x7f020003;


      Also found another meta data field is now required for my app to start with Qt 5.14, otherwise Qt fails to load files at activity start and white screen appears (with crash info in adb).

      <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>

      ADB error

      demos.apps.messaging  W  type=1400 audit(0.0:2762): avc: denied { search } for comm=45474C20496E6974 name="gpu" dev="dm-0" ino=6119491 scontext=u:r:untrusted_app:s0:c122,c257,c512,c768 tcontext=u:object_r:vendor_gles_data_file:s
                                  0 tclass=dir permissive=0
               .apps.messagin  E  Invalid ID 0x00000000.
                           Qt  E  Can't create main activity
                               E  android.content.res.Resources$NotFoundException: String array resource ID #0x0
                               E      at android.content.res.Resources.getStringArray(Resources.java:585)
                               E      at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:423)
                               E      at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:183)
                               E      at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:266)
                               E      at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:273)
                               E      at android.app.Activity.performCreate(Activity.java:7144)
                               E      at android.app.Activity.performCreate(Activity.java:7135)
                               E      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
                               E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
                               E      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
                               E      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
                               E      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
                               E      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
                               E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
                               E      at android.os.Handler.dispatchMessage(Handler.java:106)
                               E      at android.os.Looper.loop(Looper.java:193)
                               E      at android.app.ActivityThread.main(ActivityThread.java:6718)
                               E      at java.lang.reflect.Method.invoke(Native Method)
                               E      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                               E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
               OpenGLRenderer  D  Skia GL Pipeline

      I found the workaround by looking at line 423 at QtLoader.java

                          int resourceId = m_contextInfo.metaData.getInt("android.app.load_local_libs_resource_id");
                          for (String libs : prefferedAbiLibs(m_context.getResources().getStringArray(resourceId))) { 




      Would be very nice if the first issue can be resolved, so existing projects can keep said two metadata fields even if not used anymore by Qt.
      Suggestion: Generate empty arrays (with same ID's as before).
      Empty but existing arrays -> gradle won't fail at AndroidManifest steps for existing projects. Currently a app that worked till Qt 5.13 cannot be packaged/run with Qt 5.14 and when making change for Qt 5.14 again cannot run at Qt 5.13 because missing two fields.

      Unsure about the second part, let me know if should be splitted off.
      Both may be related to Qt Bug and it's related changes: https://bugreports.qt.io/browse/QTBUG-80178

      Please let me know if there's something unclear, more info required, or anything!


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            taipan BogDan Vatra
            de-live-gdev Gregor Santner
            4 Vote for this issue
            13 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes