google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.52k stars 385 forks source link

Bundletools seems to generate incorrect paths for assets sub-folders in the .apks archive #310

Closed DeliciousLines closed 1 year ago

DeliciousLines commented 1 year ago

Good evening, I am using bundletools to emulate what Google Play would do with an .aab archive (using build-apks) and I realised something goes wrong when generating the .apks archive: the assets sub-folders paths seem to no longer be valid.

For instance let us say we have the following structure in our assets folder:

assets
    textures
        a.png
        b.png

When taking a look at the .aab archive, a.png and b.png are correctly represented as assets/textures/a.png and assets/textures.b.png However this is no longer the case in the .apks archive. The structure turns into the following:

assets
    texturesa.png
    texturesb.png

This is an issue for me as I can no longer access the assets I want. Is this intentional or is it a bug?

The commands I use to generate the .aab archive:

java -jar bundletool.jar build-bundle --modules="bin\google_play\%APK_NAME%.zip" --output="bin\google_play\%APK_NAME%-UNSIGNED.aab"

"%JAVA_JDK%\bin\jarsigner.exe" -storepass <somepassword> -keystore release-key.jks -signedjar "bin\google_play\%APK_NAME%.aab" "bin\google_play\%APK_NAME%-UNSIGNED.aab" release-key

The command I use to generate the .apks archive:

java -jar bundletool.jar build-apks --bundle="bin\google_play\%APK_NAME%.aab" --output="bin\google_play\%APK_NAME%s" --ks=release-key.jks --ks-key-alias=release-key --ks-pass=pass:<somepassword> --key-pass=pass:<somepassword>

APK_NAME is set to training-time.apk

ymakhno commented 1 year ago

Please provide an example AAB to reproduce the issue.

DeliciousLines commented 1 year ago

Here you go: https://drive.google.com/file/d/1h6FxxdoqEWiujIKYT7RQG1-CeNTX27me/view?usp=share_link

ymakhno commented 1 year ago

Texture entries in your aab file are invalid as they are separated by \ instead of /:

-rw----     2.0 fat     2809 bl defN 23-Jan-25 15:16 META-INF/MANIFEST.MF
-rw----     2.0 fat     3014 bl defN 23-Jan-25 15:16 META-INF/RELEASE-.SF
-rw----     2.0 fat     1307 bl defN 23-Jan-25 15:16 META-INF/RELEASE-.RSA
-rw----     2.0 fat       10 bX defN 70-Jan-01 01:00 BundleConfig.pb
-rw----     2.0 fat     1423 bX defN 70-Jan-01 01:00 base/assets/pixel_shader.glsl
-rw----     2.0 fat     7165 bX defN 70-Jan-01 01:00 base/assets/textures\dot128.png
-rw----     2.0 fat    22490 bX defN 70-Jan-01 01:00 base/assets/textures\dot256.png
-rw----     2.0 fat     4801 bX defN 70-Jan-01 01:00 base/assets/textures\quad128.png
-rw----     2.0 fat     1017 bX defN 70-Jan-01 01:00 base/assets/vertex_shader.glsl
-rw----     2.0 fat   268848 bX defN 70-Jan-01 01:00 base/lib/arm64-v8a/libmain.so
-rw----     2.0 fat   210948 bX defN 70-Jan-01 01:00 base/lib/armeabi-v7a/libmain.so
...
DeliciousLines commented 1 year ago

All right I see, thank you!