一、配置bundletool环境
1、下载最新版的bundletool 版本号要最新的
bundletool-all-1.15.1.jarhttps://github.com/google/bundletool/releases/download/1.15.1/bundletool-all-1.15.1.jar
Releases · google/bundletool · GitHub
2、把bundletool放在/Users/sany/Library/Android/sdk/tools下
3、cd到/Users/sany/Library/Android/sdk/platform-tools
vim bundletool 创建这个文件
写入内容
#!/bin/bash
export JAVA_HOME="/opt/homebrew/Cellar/openjdk/20/libexec/openjdk.jdk/Contents/Home"
exec "${JAVA_HOME}/bin/java" -jar "/opt/homebrew/Cellar/bundletool/1.14.1/libexec/bundletool-all.jar" "$@"
修改JAVA_HOME路径和bundletool-all.jar包路径
chmod +x 一下bundletool路径
如:chmod +x /Users/sany/Library/Android/sdk/platform-tools/bundletool
二、安装
1、bundletool build-apks --bundle /Users/sany/Downloads/app-release.aab --output /Users/sany/Desktop/apks/123.apks
/Users/sany/Downloads/app-release.aab:你的aab包路径
/Users/sany/Desktop/apks/123.apks:你的存放路径
2、bundletool install-apks --apks /Users/sany/Desktop/apks/123.apks --device-id d38cdrcd0405