Reputation: 91
I'm trying to build android app bundle
from the command line using bundletool
following the instruction described in https://developer.android.com/studio/build/building-cmdline#bundletool-build
A simple android project that created basically from Android Studio is used to investigating which one compiled successfully on Android Studio.
The step to have compiled resources is ok, but it's failed on link step with aapt2. Tested with aapt2-3.4.0-5326820-windows
The command:
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 -v
compiled_resources.txt
is containing the list of .flat compiled resources that I processed before.
The error:
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.
I thought it's depending to something like 'com.android.support:appcompat-v7:26.1.0' but I don't know how to add them to aapt2 link parameters.
Does anyone meet this problem before? Any comment is highly appreciated.
Upvotes: 3
Views: 1025
Reputation: 7532
tldr: You also need to compile AppCompat resources since you're building all of this by hand, and pass them to link the same way you do with your local resources (the order matters to keep the correct overlays/overrides).
The way the Android Gradle Plugin handles resources in an app level is:
Upvotes: 1