从命令行生成Android应用程序捆绑包(* .aab)

时间:2020-11-02 03:05:26

标签: android

我想通过命令行[手动]生成应用程序包。 除了应用程序模块外,我还有许多其他模块。

我尝试手动编译每个功能模块,例如这样,不确定是否正确。

aapt2编译项目/ feature_moduel1 / src / main / res / ** / * -o

aapt2编译项目/ feature_moduel2 / src / main / res / ** / * -o

在此之后,当我尝试使用下面的命令将APT2转换为应用程序的清单和已编译的资源为protobuf格式时

aapt2链接--proto-format -o output.apk -我android_sdk / platforms / android_version / android.jar --manifest project_root / module_root / src / main / AndroidManifest.xml -R编译资源/*.flat --auto-add-overlay

出现类似以下错误:

aapt2 W 11-01 14:40:21 6340 125576 ApkAssets.cpp:138] resources.arsc 在APK中 '/ Users / <用户名> /Library/Android/sdk/platforms/android-29/android.jar' 被压缩。 root_project / feature_module / src / main / res / drawable / btn_toggle_bg.xml:3:
警告:为外部软件包生成的ID为“ android:id / background” 'android'。
root_project / feature_module / src / main / res / drawable / btn_toggle_bg.xml:6:
警告:为外部软件包“ android”生成的ID为“ android:id / toggle”。
警告:删除资源...:array / drawer_title_array不需要 默认值。

.....等等

在上述情况下,或者我可以采用的其他更好的方法中,有人遇到类似的问题吗?

1 个答案:

答案 0 :(得分:0)

使用bundletool并可能修复您的资源。