MuntashirAkon / MuntashirAkon/AppManager

Cannot properly handle duplicate APKs generated by bundletool

Open
#1,021 1 comment 0 reactions 0 assignees View on GitHub
Bug Priority: 4 Severity: 3 Status: Pending
Dominant language
Java
Stars
9k
Forks
518
PR merge metrics
No merged PRs in 30d

Description

### Please check before submitting an issue

- [X] I know what my device, OS and App Manager versions are
- [X] I know how to take logs
- [X] I know how to reproduce the issue which may not be specific to my device

### Describe the bug

If an app has native libraries, depending on how they are used and target SDK, they are stored compressed or uncompressed. In case of uncompressed, the libraries are memory mapped, therefore, there's no reason for it to be extracted. The logic for this in bundletool is described here:

https://github.com/google/bundletool/blob/da6938b27645db6488261610d2298c65ca9ba44f/src/main/java/com/android/tools/build/bundletool/splitters/NativeLibsCompressionVariantGenerator.java#LL49C5-L59C7

> If the persistent app is installable on external storage only split APKs targeting device above Android P should be uncompressed (as uncompressed native libraries crashes with ASEC external storage and support for ASEC external storage is removed in Android P).
>
> If persistent app is not installable on external storage but has native activities, native libraries should be uncompressed on Android N+ only as will crash uncompressed on Android M.
>
> Finally if persistent app is not installable on external storage and doesn't have native activities, only the split APKs targeting devices above Android M should be uncompressed.

Now, if one of the above criteria is matched, bundletool will generate duplicate APK files in order to account for compressed and uncompressed native libraries (e.g. one APK with `extractNativeLibs` set to `true` and other with `false` in the ApplicationManifest.xml).

App Manager, as of v3.1.0, will cause a crash if it find more than one APK files by the same name because it cannot handle duplicate base APK files.

### To Reproduce

_No response_

### Expected behavior

App Manager should, as done by bundletool, scan all entries to match the best base APK files with reasons included for this specific cases. (App Manager has already done quite well in selecting the correct splits in other cases.)

### Screenshots

_No response_

### Logs

_No response_

### Device info

- Device: N/A
- OS Version: N/A
- App Manager Version: v3.1.0-rc01
- Mode: N/A

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.