Platform specifc assets folders in Android App bundle's

49 Views Asked by At

The question pertains to platform specific assets that are not libraries (eg .so's). (For example a interop script generated for a specific platform, is platform specific but not a .so)

I created an Android App Bundle (aab) which has the following folder structure

base\assets\arm64-v8a\somefiles.py
base\assets\armeabi.v7a\somefiles.py
base\assets\x86\somefiles.py
base\assets\x86_64\somefiles.py

Additionally I have

base\lib\**\*.so

setup in the same way for the so libs.

When I run java -jar bundletool-1.0.0.jar build-apks --bundle=somebundle.aab --output=somebundle.apks (this example is stripped of signing args) and examine its output:

The base-master*apk contains the assets platform specific files. I had hoped they would be in the base-$PLATFORM*.apk's

For example base.master.apk has the folders:

assets\arm64-v8a\somefiles.py assets\armeabi-v8a\somefiles.py

From the docs about aabs-

"res/, lib/, and assets/: These directories are identical to those in a typical APK. When you upload your app bundle, Google Play inspects these directories and packages only the files that satisfy the target device configuration, while preserving file paths."

I assuming bundletool works in the same was Google Play.

If so why is it not behaving as the doc suggest it should?

UPDATE: I tested with a new version of bundle tool '1.15.6' just to rule that out.

UPDATE: To rule problem with my AAB I created a simple test app using Android Studio and created a AAB from that with platform specific folders in assets.

enter image description here

As expected this creates files in the aab created from Android Studio.

base\assets\arm64-v8a\test64.py
base\assets\armebi-v7a\test32.py

however a call to java -jar bundletool-all.jar build-apks ... still puts all these .py files in splits\base-master*.apk

1

There are 1 best solutions below

0
On

Comparing bundletool code, for lib and assets folder handling

lib uses NativeDirectoryTargeting builder

enter image description here

while asset doesn't which suggests that nothing in the 'assets' folder is split by platform.

Additional the only place I found Targeting.NativeDirectoryTargeting.newBuilder() usage was processing the lib folder. Which suggest that despite what I understood from the docs, the lib folder is the only thing that gets split by platform.