android - Android APP Bundles apk 无法通过 bundletool 安装(INSTALL_PARSE_FAILED_NO_CERTIFICATES)
问题描述
我通过 Android APP Bundles 构建我的应用程序,并通过
bundletools:<br>
.\bundletool-all-0.11.0.jar build-apks --bundle=gallery-v1.2.1_8-googleplay-release.aab --output=gallery-gp.apks<br>
But when I want to install the apks into devices by this commond:<br>
java -jar .\bundletool-all-0.11.0.jar install-apks --apks=gallery-gp.apks I get those errors:<br>
WARNING: An illegal reflective access operation has occurred<br>
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/E:/temp/apk/bundletool-all-0.11.0.jar) to field java.nio.Buffer.address <br>
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil<br>
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations<br>
WARNING: All illegal access operations will be denied in a future release<br>
The APKs have been extracted in the directory: C:\Users\CHRISZ~1\AppData\Local\Temp\10477684387867783528
01:12:24 E/SplitApkInstaller: Failed to finalize session : INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl1694662475.tmp/0_base-xxhdpi has no certificates at entry AndroidManifest.xml<br>
[BT:0.11.0] Error: Installation of the app failed.<br>
com.android.tools.build.bundletool.model.exceptions.InstallationException: Installation of the app failed.<br>
at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:47)
at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:41)
at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:133)
at com.android.tools.build.bundletool.device.ApksInstaller.installOnDevice(ApksInstaller.java:94)
at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:82)
at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:44)
at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:165)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:88)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
Caused by: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl1694662475.tmp/0_base-xxhdpi has no certificates at entry AndroidManifest.xml
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:91)
at com.android.ddmlib.Device.installPackages(Device.java:928)
at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:117)
... 6 more<br>
我想我真的已经签署了我的应用程序,因为我使用 ./gradlew assembleRelease 可以获得正常的 apk 并且可以成功安装到设备中,但是我使用 ./gradlew bundleRelease 获得了 aab 并且它无法安装到设备中并出现错误 INSTALL_PARSE_FAILED_NO_CERTIFICATES .
任何建议将不胜感激。
解决方案
问题已解决。进一步查看文档后得知,使用 bundletool 生成 APK 集存档时,需要指定签名文件。之所以之前没有指定,但是生成的apks还是可以安装的,是因为bundletool默认会使用debug签名,而当我生成这个文件的时候,我机器上的debug签名因为某种原因丢失了,所以生成的由于缺少签名,无法安装文件。在我的机器上重新生成调试签名文件后,再次生成的apk可以安装。谢谢您的帮助。
推荐阅读
- linux - 使用 docker 命令将 Makefile 转换为 windows
- typescript - 泛型类型被视为打字稿中的值
- c# - 将字符串转换为双精度时字符串格式错误
- python - 请解释以下内联python代码?index = [n for n, value in enumerate(self.Variable[i]) if value == 1]
- mongodb - 查找日期在一分钟内的文档
- java - 如何将配置清理策略添加为“紧凑”以在下面的 Java 代码中输入主题?
- c++ - 是否有一种标准方法可以在不使用迭代器语法的情况下使用基于范围的 for 循环迭代一系列迭代器
- python - 列出python文件中的类
- c++ - 为什么我不能将一个字符串的索引位置分配给另一个字符串的索引位置,但我可以将它分配给一个中间字符?
- reactjs - next-seo 不在 SSR 中渲染?