Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Produce an APK for multiple architectures for Qt projects

In 3d party APK files I notice there are folders for different architectures - armv7, arm64, x86, mips - so a single APK works for multiple architectures, supported by Android.

However, I don't seem to find a way to do that with Qt projects. I have a project that targets multiple architectures, but I can only produce an APK for an architecture at a time, only for the currently active project kit.

Is it possible to produce such a muti-arch APK for a Qt projects?

like image 706
dtech Avatar asked Oct 29 '22 19:10

dtech


1 Answers

I have found a work-around for this problem. I came across this problem when my Qt application had to comply to Google's requirement of providing 64 binaries for 64 bit architecture. Although this process is not totally automated but it works.

1- Build your APKs for different architectures(in my case armeabi-v7a and arm64-v8a)

2- Open all APKs for editing with any compression/decompression software(I used the default provided by Ubuntu. On windows you can use WinRaR)

3- Go to "lib" folder and copy the folder named with the architecture (arm64-v8a, armeabi-v7a, etc.)

4- Consolidate all the copied folders from step#3 into the lib folder of any one APK. Now we will use this APK to move forward

5- Go to the folder named "META-INF" on APK root and delete files *.RSA and *.SF

6- Now close the APK file.

7- Go to https://github.com/patrickfav/uber-apk-signer and download the Jar file. You can use this tool to zipalign and sign your package again. Use the jar as follows.

java -jar uber-apk-signer-1.0.0.jar --apks ./android-build-release-signed.apk --ks android_release.keystore --ksAlias your_certificate_alias

Now you can publish the final APK to Google Play. Cheers!

like image 82
Farhan Haider Avatar answered Nov 18 '22 00:11

Farhan Haider