-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Simplify and fix split configs detection #9378
Conversation
Unit test? (I assume this is testable?)
I'm not sure I understand this. Additionally, I now observe: android/src/Xamarin.Android.Build.Tasks/Resources/MonoRuntimeProvider.Bundled.java Line 25 in 4429c52
Is there any requirement that
Is it thus possible to have a scenario in which What would this do to app startup? Would it work properly? (I can't trivially follow the "split apk" logic in |
Whenever the app is built in the AAB format, Android splits things up into a single base apk and a set of split APKs.
As you can see, this is resources and the Java code (it would also contain our assemblies and assembly blobs The only split APK here,
So we're only interested in scanning the split APK(s) for assembly blobs, assemblies and the runtime config, |
I added some log entries to see what's in the three
The array passed from |
7cc380c
to
f986da3
Compare
haveSplitApks = runtimePackage.splitSourceDirs.length > 1; | ||
} | ||
} | ||
boolean haveSplitApks = runtimePackage.splitSourceDirs != null && runtimePackage.splitSourceDirs.length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code was checking > 1
? Does it actually need to contain more than one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to contain 2, for all the apps I tested (long time ago), but now the apps I test with create just a single entry, thus the change. I think the change might have been made in Android 14, since I remember seeing 2 split apks in Android 13.
We use
ApplicationInfo.splitSourceDirs
to detect whether the application uses split config files.Those files are created by Android when an AAB is used to deploy application (e.g. via Google Play Store).
When they are present, the base APK file doesn't contain any
lib/
directories and we can simply skipscanning it for those entries, thus saving on startup time. We used to check whether there are more than
one entry in
splitSourceDirs
, which used to be the case, but it seems that the recent Android versions(at least API 33 and newer) can have just a single entry in the array. Because of that, we were scanning
all the APK files on those Android versions, wasting time at startup.
Fix the check by probing whether array exists and contains at least a single entry. Additionally, remove
API 21 check, since this is our lowest supported API level.