How to include C++ static libraries into the android apk of a QtApp, when building with Gradle
-
@raven-worx My app is running all fine when built with ant. it started to crash only after building with gradle
@Nelson_Piquet
check the catlog. Ther should be more info what exactly caused the crash and where. -
@Nelson_Piquet
check the catlog. Ther should be more info what exactly caused the crash and where.@raven-worx Following is the crash log I am getting:
handle_notify_event, send msg [submit:trigger=0,bugtype=2,modulename=com.mycompany.myapp,level=1,testtype=NORMAL,path=/data/log/unzip/GRA-L09_GRA-L09C432B321a_0000000000_20161014165530_crash,mode=1;]
10-14 16:55:30.825 3199 3436 I logserver: send_to_client, send to (9) res = 188
10-14 16:55:30.844 3443 3462 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.util.ReportTools.getUserType(ReportTools.java:86)
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.util.ReportTools.isBetaUser(ReportTools.java:73)
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.util.ReportTools.report(ReportTools.java:58)
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.util.HwUserBehaviourRecord.appExitRecord(HwUserBehaviourRecord.java:65)
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.am.ActivityManagerService$UiHandler.handleMessage(ActivityManagerService.java:1521)
10-14 16:55:30.844 3443 3462 W System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
10-14 16:55:30.844 3443 3462 W System.err: at android.os.Looper.loop(Looper.java:150)
10-14 16:55:30.844 3443 3462 W System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
10-14 16:55:30.844 3443 3462 W System.err: at com.android.server.ServiceThread.run(ServiceThread.java:46)
10-14 16:55:30.844 3443 3462 E ReportTools: This is not beta user build -
Checked the catlog in another android device with better logging. Following is the cause of the crash
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/com.mycompany.myapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-2/lib/arm, /data/app/com.mycompany.myapp-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
Not sure what I am doing wrong here
-
Checked the catlog in another android device with better logging. Following is the cause of the crash
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/com.mycompany.myapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-2/lib/arm, /data/app/com.mycompany.myapp-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
Not sure what I am doing wrong here
@Nelson_Piquet
did you create the Android tempaltes (as described here) so that the android classes are also deployed? -
I have the Androidmanifest file & the res folder inside MyAppfolder/android with ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android in MyApp.pro set. However, I have to move the manifest file 6 res folder inside MyAppfolder/android/src/main for gradle to build without issues.
-
by the way, I am doing this build command line using the following install step
androiddeployqt --sign mykeystore.keystore myAlias --storepass myPassword --gradle clean build --output android --verbose --input android-libMyApp.so-deployment-settings.json
-
by the way, I am doing this build command line using the following install step
androiddeployqt --sign mykeystore.keystore myAlias --storepass myPassword --gradle clean build --output android --verbose --input android-libMyApp.so-deployment-settings.json
@Nelson_Piquet
so you are not using QtCreator? -
@Nelson_Piquet
so you are not using QtCreator?@raven-worx In my team all use QtCreator including me as well. But, we need to make a build-script for jenkins & Continious Integration.
The build-script builds successfully when built with ant that comes by default with androiddeployqt We need the android part to build using gradle. Hence, I have appended this --gradle to androiddeployqt command & trying to build this with gradle.
Again, the reason of trying to use gradle here is for versioning. If you google how to auto-increment version number of android app, then everybody suggests to do it with gradle. I dont know why ? Everybody suggest to move on to gradle in the android community specially. May be there are other reasons as well. At the moment I am just trying to build our QtApp using gradle
-
@raven-worx In my team all use QtCreator including me as well. But, we need to make a build-script for jenkins & Continious Integration.
The build-script builds successfully when built with ant that comes by default with androiddeployqt We need the android part to build using gradle. Hence, I have appended this --gradle to androiddeployqt command & trying to build this with gradle.
Again, the reason of trying to use gradle here is for versioning. If you google how to auto-increment version number of android app, then everybody suggests to do it with gradle. I dont know why ? Everybody suggest to move on to gradle in the android community specially. May be there are other reasons as well. At the moment I am just trying to build our QtApp using gradle
@Nelson_Piquet
IIRC Qtcreator shows the build command in the console during the build -
@Nelson_Piquet
IIRC Qtcreator shows the build command in the console during the build@raven-worx Yeah. I got that from the compile log of qtCreator. Thats really good about Qt. The command is correctly set now otherwise the build would not succeed. I think I am missing some dependency/plugin or something in build.gradle which is causing the following error & crashing the app on launch
"Didn't find class "org.qtproject.qt5.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/com.mycompany.myapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-2/lib/arm, /data/app/com.mycompany.myapp-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]"