I'm trying to create Android App Bundle (.aab) as it is described here Build your app from the command line.
I first compile the resources:
aapt2 compile res/drawable-hdpi/icon.png -o compiled_resources
aapt2 compile res/drawable-ldpi/icon.png -o compiled_resources
aapt2 compile res/drawable-mdpi/icon.png -o compiled_resources
aapt2 compile res/values/strings.xml -o compiled_resources
And then use the link command:
aapt2 link --proto-format -o output.apk -I android.jar --manifest manifest/AndroidManifest.xml -R compiled_resources/drawable-hdpi_icon.png.flat compiled_resources/drawable-ldpi_icon.png.flat compiled_resources/drawable-mdpi_icon.png.flat compiled_resources/values_strings.arsc.flat --auto-add-overlay
Now I want to create the base.zip folder for the bundletool
, and it requires, as it is stated in here, the AndroidManifest.xml
and resources.pb
files, which are located within the output.apk file that the earlier aapt2 link
command created.
Compile and link your app's resources says: "You can then extract content from the output APK".
I did a search online and found some methods to extract files from an apk
. The most popular one includes apktool
with the simple command: apktool d output.apk -f
, another one uses aapt
with: aapt d xmltree output.apk AndroidManifest.xml
.
Both of these commands fail with xml
reading errors.
My guess is that the reason for that is that AndroidManifest.xml
is not really an xml
file as one would expect in a regular apk
file (created with aapt
for example), but an xml
file of the protobuf format
, which apktool
and aapt
don't expect.
Does anybody know how the link expect us to: "extract content from the output APK"?