After QT5 -> QT6 porting: No package identifier when getting name for resource number 0x00000000 - Problem with Manifest?
Solved
Mobile and Embedded
-
Hi, I got the following problem after porting my app to QT6. I can run in on desktop but can't make it work on Android. It gets installed but the result is a white screen with the app name and icon at the very top.
This is what QT Creator shows when the app is deployed and "running":
W ActivityThread: Application org.dontpanic can be debugged on port 8100... W zygote64: miui_dex2oat: OatFile: /data/app/org.dontpanic-kAoNR5acxqZK06dj0v31KQ==/oat/arm64/base.odex Compiler-Filter = quicken W ResourceType: No package identifier when getting name for resource number 0x00000000 W ResourceType: No package identifier when getting name for resource number 0x00000000 W ResourceType: No package identifier when getting value for resource number 0x00000000 E Qt : Can't create main activity E Qt : android.content.res.Resources$NotFoundException: String resource ID #0x0 E Qt : at android.content.res.Resources.getText(Resources.java:351) E Qt : at android.content.res.MiuiResources.getText(MiuiResources.java:97) E Qt : at android.content.res.Resources.getString(Resources.java:445) E Qt : at org.qtproject.qt.android.bindings.QtLoader.startApp(QtLoader.java:254) E Qt : at org.qtproject.qt.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:135) E Qt : at org.qtproject.qt.android.bindings.QtActivity.onCreateHook(QtActivity.java:263) E Qt : at org.qtproject.qt.android.bindings.QtActivity.onCreate(QtActivity.java:283) E Qt : at android.app.Activity.performCreate(Activity.java:7088) E Qt : at android.app.Activity.performCreate(Activity.java:7079) E Qt : at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215) E Qt : at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) E Qt : at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895) E Qt : at android.app.ActivityThread.-wrap11(Unknown Source:0) E Qt : at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616) E Qt : at android.os.Handler.dispatchMessage(Handler.java:106) E Qt : at android.os.Looper.loop(Looper.java:176) E Qt : at android.app.ActivityThread.main(ActivityThread.java:6651) E Qt : at java.lang.reflect.Method.invoke(Native Method) E Qt : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) E Qt : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
After reading some other threads I suspect the Manifest file to cause this. I have followed the instructions here, especially by removing the deprecated lines but nothing helped. Here is my manifest:
<?xml version="1.0"?> <manifest package="org.dontpanic" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0" android:versionCode="20000" android:installLocation="auto"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="31"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true" android:extractNativeLibs="true"/> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="@string/app_name" android:screenOrientation="sensorPortrait" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> <meta-data android:name="android.app.background_running" android:value="false"/> </activity> <service android:name="org.dontpanic.NotificationService"> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> </service> <receiver android:name="org.dontpanic.NotificationReceiver" android:enabled="true" android:exported="true"/> <receiver android:name="org.dontpanic.RebootReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.BOOT"/> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.QUICKBOOT_POWERON"/> <action android:name="android.intent.action.REBOOT"/> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> <action android:name="android.intent.action.USER_PRESENT"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </receiver> </application> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> </manifest>
Do I have to change anything else? Like the gradle files or something? Here is the rest of the project if needed.
Thanks! -
I have found a solution! I did multiple things:
- Used newer template files for Android from Qt/6.2.3/android_arm64_v8a/src/android/templates/ (res/values/libs.xml - overwritten, build.gradle - overwritten, AndroidManifest.xml - copy and paste and then edited the content and added the missing things from my old one)
- Used newer gradle files from /Qt/6.2.3/android_arm64_v8a/src/3rdparty/gradle/gradle/wrapper/ - overwritten
- Upgrade of Qt Creator, Qt 6.2.2 -> 6.2.3, Android SDK, Android NDK
My current Manifest:
<?xml version="1.0"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.dontpanic" android:installLocation="auto" android:versionCode="20000" android:versionName="2.0"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="31"/> <!-- The comment below will be replaced with dependencies permissions upon deployment. Remove the comment if you do not require these default permissions. --> <!-- %%INSERT_PERMISSIONS --> <!-- The comment below will be replaced with dependencies permissions upon deployment. Remove the comment if you do not require these default features. --> <!-- %%INSERT_FEATURES --> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" /> <application android:name="org.qtproject.qt.android.bindings.QtApplication" android:extractNativeLibs="true" android:hardwareAccelerated="true" android:label="@string/app_name" android:icon="@drawable/icon" android:requestLegacyExternalStorage="true"> <activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="@string/app_name" android:launchMode="singleTop" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <!-- Application arguments --> <meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --" /> <!-- Application arguments --> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --" /> <!-- Background running --> <!-- Warning: changing this value to true may cause unexpected crashes if the application still try to draw after "applicationStateChanged(Qt::ApplicationSuspended)" signal is sent! --> <meta-data android:name="android.app.background_running" android:value="false" /> <!-- Background running --> <!-- extract android style --> <!-- available android:values : * default - In most cases this will be the same as "full", but it can also be * something else if needed, e.g., for compatibility reasons * full - useful QWidget & Quick Controls 1 apps * minimal - useful for Quick Controls 2 apps, it is much faster than "full" * none - useful for apps that don't use any of the above Qt modules --> <meta-data android:name="android.app.extract_android_style" android:value="minimal" /> <!-- extract android style --> </activity> <service android:name="org.dontpanic.NotificationService"> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> </service> <receiver android:name="org.dontpanic.NotificationReceiver" android:enabled="true" android:exported="true"/> <receiver android:name="org.dontpanic.RebootReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.BOOT"/> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.QUICKBOOT_POWERON"/> <action android:name="android.intent.action.REBOOT"/> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> <action android:name="android.intent.action.USER_PRESENT"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </receiver> </application> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> </manifest>