AAPT: error, qt libs not found
-
wrote on 29 Jun 2021, 11:23 last edited by
Hi,
I'm trying to develop a flutter plugin able to embed an android qt apk. On our project, https://gitlab.com/elRepo.io/elRepo.io-android/, we already accomplish that. We have an Qt apk bundled inside a flutter apk.
I'm trying to separate this into a flutter plugin that you can add to your app and it bundle the Qt apk for you.
The problem is that copying the same code found in our already working bundle, I get the following errors:
AAPT: error: resource array/qt_sources (aka net.retroshare.flutter_retroshare_service_example:array/qt_sources) not found. AAPT: error: resource array/qt_libs (aka net.retroshare.flutter_retroshare_service_example:array/qt_libs) not found. AAPT: error: resource array/bundled_libs (aka net.retroshare.flutter_retroshare_service_example:array/bundled_libs) not found. AAPT: error: resource array/bundled_in_lib (aka net.retroshare.flutter_retroshare_service_example:array/bundled_in_lib) not found. AAPT: error: resource array/bundled_in_assets (aka net.retroshare.flutter_retroshare_service_example:array/bundled_in_assets) not found.
If we take a look at this commit, https://gitlab.com/elRepo.io/flutter-retroshare-service/-/commit/ef101bc8385bd36628928cab4450d4119d56425c, we saw that the modified files are
android/build.gradle
,android/src/main/AndroidManifest.xml
,example/android/app/build.gradle
. Whereexample
directory contain a flutter app that call the plugin.The relevant code that causes the error is this one, extracted from here:
<application> <service android:name=".RetroShareServiceAndroid" android:label="RetroShare Service" android:process=":rs"> <!-- android:exported="true" must be added to be able to run the service ++ from adb shell ++ android:process=":rs" is needed to force the service to run on ++ a separate process than the Activity --> <!-- Qt Application to launch --> <meta-data android:name="android.app.lib_name" android:value="retroshare-service"/> <!-- Ministro --> <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> <meta-data android:name="android.app.repository" android:value="default"/> <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> <!-- Deploy Qt libs as part of package --> <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/> <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> <!-- Run with local libs --> <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/> <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> <meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so:plugins/bearer/libqandroidbearer.so"/> <meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroidExtras.jar:jar/QtAndroidBearer.jar"/> <meta-data android:name="android.app.static_init_classes" android:value=""/> <!-- Messages maps --> <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> <!-- Messages maps --> <!-- Background running --> <meta-data android:name="android.app.background_running" android:value="true"/> <!-- Background running --> </service> </application>
If I add this piece of code into de example app it neither work, with the same error, and should work.
I think this is not about the apk bundling, I think the problem is how to declare the QT libraries on the build.gradle. It should be easy to fix but i'm ignorant about how gradle works.
Maybe I have to add a
build.gradle
file inside theandroid/src
directory? I have to move de qt lib declarations on other part of thebuild.gradle
?
1/1