DCloud_App_Array
DCloud_App_Array
  • 发布:2021-05-12 21:08
  • 更新:2024-08-21 11:11
  • 阅读:33884

Google Play上传应用要求Android App Bundle (AAB) 格式的相关说明

分类:uni-app

概述

Android App Bundle是Google在2018年推出的Apk动态组件化打包技术,通过AAB格式的App Bundle文件为你的设备动态组装apk来安装。其本质就是把Apk拆分成了多个模块,之前是把一个大而全的apk装到你手机里面,但是你其实用不到这么多东西,把暂时不需要的东西拿出来,这样就会节省很多的资源空间。除了效率和模块化之外,Android App Bundle现在还通过为新安装推出应用程序签名密钥升级提供更高的安全性。
注意:Android App Bundle (AAB) 与 APK 不同,AAB纯粹是为了上传Google Play而设计的,用户无法直接使用安装到手机上,测试AAB文件参考章节手机安装使用AAB格式文件

2021年8月开始Google Play要求新发布应用必须使用Android App Bundle(AAB)格式,即.aab格式文件;更新已经上架的应用还可以继续使用apk格式文件上传

详情参考Google官方博客说明:New Android App Bundle and target API level requirements in 2021

注:Google Play同时要求应用适配Android11,即 targetSdkVersion要求大于等于30。从2021年8月开始发布新应用必须设置targetSdkVersion大于等于30;从2021年11月开始更新已经上架的应用必须设置targetSdkVersion大于等于30。
HBuilderX3.1.0+版本已适配支持Android11,参考https://ask.dcloud.net.cn/article/193设置targetSdkVersion

HBuilderX云端打包支持Android App Bundle (AAB)

HBuilderX3.1.16+版本云端打包已支持Android App Bundle (AAB)格式,由于仅上传Google Play时才需要使用AAB格式文件,提交云端打包配置渠道为“GooglePlay”时云端打包自动生成AAB格式,其它渠道云端打包仍然使用APK格式。

注意:Android App Bundle (AAB)格式不支持安心打包,勾选“GooglePlay”渠道后将使用传统打包模式提交云端打包

本地离线打包支持Android App Bundle (AAB)

离线打包需要原生开发环境Android Studio,使用App离线SDK一直都支持Android App Bundle (AAB),详情参考https://ask.dcloud.net.cn/article/36356

手机安装使用AAB格式文件

Android App Bundle (AAB) 格式文件仅用于上传到Google Play,无法直接将AAB文件安装到手机上,如果要在手机上安装测试AAB格式包,可以使用bundletool工具
可以参考Google官方文档:https://developer.android.com/studio/command-line/bundletool
注意:Google官方文档需要科学上网才能打开

以下是我们整理的操作步骤

  1. 准备环境
    使用bundletool工具需要java环境,建议使用JRE8环境,请自行下载安装,并配置好系统环境变量

  2. 下载bundletool.jar包
    下载地址:https://github.com/google/bundletool/releases

  3. 使用cmd命令将aab文件转换为apks文件
    命令格式参考如下:

    java -jar <bundletool.jar的路径> build-apks --bundle=<.aab文件的路径> --output=<输出.apks的路径> --ks=<打包使用的证书文件的路径> --ks-pass=pass:<证书密码> --ks-key-alias=<证书别名> --key-pass=pass:<证书别名密码,通常与证书密码一致>

    将前面下载的bundletool-all-1.6.0.jar、云端打包生成的myapp.aab、证书文件my.keystore(证书别名为test、密码为123456)放到同一目录,在命令行中切换到当前目录,使用以下命令生成myapp.apks

    java -jar bundletool-all-1.6.0.jar build-apks --bundle=myapp.aab --output=myapp.apks --ks=my.keystore --ks-pass=pass:123456 --ks-key-alias=test --key-pass=pass:123456

    注意:生成apks文件会非常大,但安装到手机上占用空间会比原来apk格式文件小(这是因为只安装当前设备需要的资源)。另外可以在命令行中添加--connected-device参数来生成仅针对当前连接设备的apks文件,减少apks文件大小

  4. 使用cmd命令安装apks文件到手机上
    命令格式参考如下:

    java -jar <bundletool.jar的路径> install-apks --apks=<上一步中生成的.apks文件路径>

    注意:安装apks需要当前环境存的adb可以运行,建议安装Android SDK工具

常见问题

根据Google的要求,使用aab格式上传应用必须加入Google签名保护计划, 加入后需要提交签名证书文件。
注意:不是直接提交签名证书文件,而是要按规范进行转换
建议参考文档:Android Google Play app signing

1 关注 分享
Jerry_Deng

要回复文章请先登录注册

a***@akila3d.com

a***@akila3d.com

回复 a***@akila3d.com :
HbuilderX版本 4.15
2024-08-21 11:11
a***@akila3d.com

a***@akila3d.com

打包勾选了Google 渠道,生成的为什么还是apk包啊
2024-08-21 11:08
wwwzzz

wwwzzz

回复 m***@163.com :
遇到加一,请问解决了吗
2023-10-30 09:06
wwwzzz

wwwzzz

回复 4***@qq.com :
遇到加一,请问解决了吗
2023-10-30 09:06
4***@qq.com

4***@qq.com

Issue found: Violation of Device and Network Abuse policy

We reviewed SDKs used by your app and found noncompliant version(s) of SDK(s) which contain code to download or install applications from unknown sources outside of Google Play.

Issue details

We found an issue in the following area(s):

Version code 101:SDK: Dcloud

Additionally, follow these steps to bring your app into compliance:

You may consider upgrading to a policy-compliant version of this SDK, if available from your SDK provider or removing the SDK.About the Device and Network Abuse policy

An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (for example, dex, JAR, .so files) from a source other than Google Play. This restriction does not apply to code that runs in a virtual machine or an interpreter where either provides indirect access to Android APIs (such as JavaScript in a webview or browser).

Apps or third-party code (for example, SDKs) with interpreted languages (JavaScript, Python, Lua, etc.) loaded at run time (for example, not packaged with the app) must not allow potential violations of Google Play policies. Please note that you are responsible for all aspects of your app by using an SDK in your app, you are responsible for how that SDK behaves within your app.
2023-10-18 16:31
m***@163.com

m***@163.com

Issue found: Violation of Device and Network Abuse policy
We reviewed SDKs used by your app and found noncompliant version(s) of SDK(s) which contain code to download or install applications from unknown sources outside of Google Play.
Issue details
We found an issue in the following area(s):
Version code 101:SDK: Dcloud
Additionally, follow these steps to bring your app into compliance:
You may consider upgrading to a policy-compliant version of this SDK, if available from your SDK provider or removing the SDK.About the Device and Network Abuse policy
An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (for example, dex, JAR, .so files) from a source other than Google Play. This restriction does not apply to code that runs in a virtual machine or an interpreter where either provides indirect access to Android APIs (such as JavaScript in a webview or browser).
Apps or third-party code (for example, SDKs) with interpreted languages (JavaScript, Python, Lua, etc.) loaded at run time (for example, not packaged with the app) must not allow potential violations of Google Play policies. Please note that you are responsible for all aspects of your app by using an SDK in your app, you are responsible for how that SDK behaves within your app.

这个是什么问题?
2023-10-18 11:43
初樰

初樰

https://www.chuxueyun.com/#/pages/aab 在线aab转换apk
2023-07-11 16:51
味蕾

味蕾

我已经按照https://blog.csdn.net/zhaoyanjun6/article/details/105561341的方式升级了签名证书文件,重新上传App Bundle后,签名还是旧的?
2023-05-17 10:52
1***@qq.com

1***@qq.com

非uniapp开发,有人用5+sdk离线打包上架google play,然后调用谷歌支付或者paypal支付成功的吗?
2022-11-04 17:06
邠心

邠心

为什么加了FCM就不允许打包测试,只允许打aab包,为什么会有这样的限制,不觉得这限制很弱智吗
2022-09-29 15:13