为 Qt 项目的多种架构生成 APK [英] Produce an APK for multiple architectures for Qt projects

查看:45
本文介绍了为 Qt 项目的多种架构生成 APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 3d 派对 APK 文件中,我注意到有不同架构的文件夹 - armv7、arm64、x86、mips - 所以一个 APK 适用于多种架构,Android 支持.

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.

但是,我似乎没有找到用 Qt 项目做到这一点的方法.我有一个针对多个架构的项目,但我一次只能为一个架构生成一个 APK,只能为当前活动的项目工具包生成.

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.

是否有可能为 Qt 项目生成这样的多架构 APK?

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

推荐答案

我找到了解决此问题的方法.当我的 Qt 应用程序必须符合 Google 为 64 位架构提供 64 位二进制文​​件的要求时,我遇到了这个问题.虽然这个过程不是完全自动化的,但它是有效的.

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- 为不同的架构构建 APK(在我的例子中是 armeabi-v7a 和 arm64-v8a)

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

2- 使用任何压缩/解压软件打开所有 APK 进行编辑(我使用的是 Ubuntu 提供的默认值.在 Windows 上您可以使用 WinRaR)

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- 转到lib"文件夹并复制以架构命名的文件夹(arm64-v8a、armeabi-v7a 等)

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

4- 将第 3 步中所有复制的文件夹合并到任何一个 APK 的 lib 文件夹中.现在我们将使用这个 APK 继续前进

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- 转到 APK 根目录下名为META-INF"的文件夹并删除文件 *.RSA 和 *.SF

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

6- 现在关闭 APK 文件.

6- Now close the APK file.

7- 转到 https://github.com/patrickfav/uber-apk-signer 并下载 Jar 文件.您可以使用此工具 zipalign 并再次对您的包裹进行签名.使用jar如下.

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

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

现在您可以将最终的 APK 发布到 Google Play.干杯!

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

这篇关于为 Qt 项目的多种架构生成 APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆