gpt4 book ai didi

android - 在没有 bundletool 的情况下从命令行使用动态功能模块构建 apk

转载 作者:行者123 更新时间:2023-11-29 02:20:09 25 4
gpt4 key购买 nike

我们有几个动态功能模块。我们希望使用 ADB 和侧载轻松构建我们应用程序的调试版本。当我们使用 ./gradlew app:assembleDebug 时,我们的动态模块不包含在 apk 中。我知道有一种方法可以通过 Android Studio 执行此操作:

enter image description here

但是有没有办法使用 ADB 来做到这一点?基本上只是说“包括所有动态功能模块,就好像它们是基本模块的一部分”。

我还知道每个开发人员都可以使用 bundletool 为他们的测试设备组装/构建 apk。但是这个多步骤过程会减慢我们这些喜欢 CL gradle 的人的速度。

最佳答案

要么我一直在使用旧版本的 Android Gradle 插件,要么我调用的是 assemble,而不是 install。当使用 AGP 3.5.0-beta04 调用 ./gradlew app:installDebug 然后 bundletool 运行并自动上传必要的拆分 apks:

...
The APKs have been extracted in the directory: /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942
Installing APKs 'base-xxhdpi.apk, base-master_2.apk, base-en.apk, base-x86_2.apk, my-dynamic-feature-xxhdpi.apk, my-dynamic-feature-master.apk' on 'Nexus_5X_API_25(AVD) - 7.1.1' for app:debug
01:30:05 I/SplitApkInstallerBase: Created install session 1503835220 with options -r -t -S 5653406
01:30:05 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-xxhdpi.apk to session 1503835220
01:30:05 D/SplitApkInstaller: Executing : cmd package install-write -S 285980 1503835220 0_base-xxhdpi -
01:30:05 V/ddms: execute: running cmd package install-write -S 285980 1503835220 0_base-xxhdpi -
01:30:05 V/ddms: execute 'cmd package install-write -S 285980 1503835220 0_base-xxhdpi -' on 'emulator-5554' : EOF hit. Read: -1
01:30:05 V/ddms: execute: returning
01:30:05 D/SplitApkInstaller: Successfully uploaded base-xxhdpi.apk
01:30:05 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-master_2.apk to session 1503835220
01:30:05 D/SplitApkInstaller: Executing : cmd package install-write -S 4887264 1503835220 1_base-master__ -
01:30:05 V/ddms: execute: running cmd package install-write -S 4887264 1503835220 1_base-master__ -
01:30:06 V/ddms: execute 'cmd package install-write -S 4887264 1503835220 1_base-master__ -' on 'emulator-5554' : EOF hit. Read: -1
01:30:06 V/ddms: execute: returning
01:30:06 D/SplitApkInstaller: Successfully uploaded base-master_2.apk
01:30:06 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-en.apk to session 1503835220
01:30:06 D/SplitApkInstaller: Executing : cmd package install-write -S 32342 1503835220 2_base-en -
01:30:06 V/ddms: execute: running cmd package install-write -S 32342 1503835220 2_base-en -
01:30:06 V/ddms: execute 'cmd package install-write -S 32342 1503835220 2_base-en -' on 'emulator-5554' : EOF hit. Read: -1
01:30:06 V/ddms: execute: returning
01:30:06 D/SplitApkInstaller: Successfully uploaded base-en.apk
01:30:06 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-x86_2.apk to session 1503835220
01:30:06 D/SplitApkInstaller: Executing : cmd package install-write -S 401632 1503835220 3_base-x____ -
01:30:06 V/ddms: execute: running cmd package install-write -S 401632 1503835220 3_base-x____ -
01:30:06 V/ddms: execute 'cmd package install-write -S 401632 1503835220 3_base-x____ -' on 'emulator-5554' : EOF hit. Read: -1
01:30:06 V/ddms: execute: returning
01:30:06 D/SplitApkInstaller: Successfully uploaded base-x86_2.apk
01:30:06 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/my-dynamic-feature-xxhdpi.apk to session 1503835220
01:30:06 D/SplitApkInstaller: Executing : cmd package install-write -S 15362 1503835220 4_my-dynamic-feature-xxhdpi -
01:30:06 V/ddms: execute: running cmd package install-write -S 15362 1503835220 4_my-dynamic-feature-xxhdpi -
01:30:06 V/ddms: execute 'cmd package install-write -S 15362 1503835220 4_my-dynamic-feature-xxhdpi -' on 'emulator-5554' : EOF hit. Read: -1
01:30:06 V/ddms: execute: returning
01:30:06 D/SplitApkInstaller: Successfully uploaded my-dynamic-feature-xxhdpi.apk
01:30:06 I/SplitApkInstaller: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/my-dynamic-feature-master.apk to session 1503835220
01:30:06 D/SplitApkInstaller: Executing : cmd package install-write -S 30826 1503835220 5_my-dynamic-feature-master -
01:30:06 V/ddms: execute: running cmd package install-write -S 30826 1503835220 5_my-dynamic-feature-master -
01:30:06 V/ddms: execute 'cmd package install-write -S 30826 1503835220 5_my-dynamic-feature-master -' on 'emulator-5554' : EOF hit. Read: -1
01:30:06 V/ddms: execute: returning
01:30:06 D/SplitApkInstaller: Successfully uploaded my-dynamic-feature-master.apk
01:30:06 V/ddms: execute: running cmd package install-commit 1503835220
01:30:14 V/ddms: execute 'cmd package install-commit 1503835220' on 'emulator-5554' : EOF hit. Read: -1
01:30:14 V/ddms: execute: returning
01:30:14 D/SplitApkInstaller: Successfully install apks: [/var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-xxhdpi.apk, /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-master_2.apk, /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-en.apk, /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/base-x86_2.apk, /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/my-dynamic-feature-xxhdpi.apk, /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect457573925930020942/my-dynamic-feature-master.apk]
Installed on 1 device.

关于android - 在没有 bundletool 的情况下从命令行使用动态功能模块构建 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56690993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com