我试图按照android app bundle中描述的指令使用bundletool从命令行构建https://developer.android.com/studio/build/building-cmdline#bundletool-build
一个简单的android项目基本上是从Android创建的,它习惯于调查在Android上成功编译的哪一个。
编译资源的步骤是可以的,但是在使用aapt2的链接步骤中失败了。用aapt2-3.4.0-5326820-windows测试
命令
set ANDROID_TOOL=%ANDROID_SDK%/platforms/android-26/android.jar
%AAPT2% link --proto-format -o output.apk -I %ANDROID_TOOL% --manifest %CURRENT_DIR%/app/src/main/AndroidManifest.xml -R @compiled_resources.txt --auto-add-overlay -vcompiled_resources.txt包含我以前处理过的.flat编译资源的列表。
错误
error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.example.doandominh.simpleaab:style/Theme.AppCompat.Light.DarkActionBar) not found.
I:\RnD\AAB\SimpleAAB\\app\src\main\res\values\styles.xml:6: error: style attribute 'attr/colorPrimary (aka com.example.doandominh.simpleaab:attr/colorPrimary)' not found.
I:\RnD\AAB\SimpleAAB\\app\src\main\res\values\styles.xml:7: error: style attribute 'attr/colorPrimaryDark (aka com.example.doandominh.simpleaab:attr/colorPrimaryDark)' not found.
I:\RnD\AAB\SimpleAAB\\app\src\main\res\values\styles.xml:8: error: style attribute 'attr/colorAccent (aka com.example.doandominh.simpleaab:attr/colorAccent)' not found.
error: failed linking references.我认为这取决于'com.android.support:appcompat-v7:26.1.0‘之类的东西,但我不知道如何将它们添加到aapt2链接参数中。
以前有人遇到过这个问题吗?任何评论都是非常感谢的。
发布于 2019-05-02 13:15:25
tldr:您还需要编译AppCompat资源,因为您正在手工构建所有这些资源,并传递它们以与本地资源相同的方式链接(订单关系到保持正确的覆盖/覆盖)。
Android Gradle插件在应用程序级别处理资源的方式如下:
https://stackoverflow.com/questions/55949400
复制相似问题