Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix using universal apk when abi-splits are present #3

Merged

Conversation

jarl-balling
Copy link
Contributor

Before: plugin failed to use universalApk if abi-splits were also present.
Now: if abi-splits are present then look for universalApk before throwing error.

Fixes issue #2

@Malinskiy
Copy link
Member

Hey. Thanks for submitting this
Curious if there is a better way to check for universal apk as an API instead of relying on file name substring?

@jarl-balling
Copy link
Contributor Author

Hey. Thanks for submitting this Curious if there is a better way to check for universal apk as an API instead of relying on file name substring?

Howdy! For now all I have is this:

When building multiple APKs, Gradle generates APK filenames using the following scheme: modulename-screendensityABI-buildvariant.apk
If universalApk is enabled for per-ABI APKs, Gradle uses universal as the ABI portion of the universal APK filename.
Source: https://developer.android.com/build/configure-apk-splits?hl=en#build-apks-filename

Now that I think about it the proposed change might lead to a different error down the line for apps with moduleName/apkName akin to myUniversalApp-x86abi-developmentDebug.apk. I'll look into it, maybe there is a better way to do it.

@jarl-balling
Copy link
Contributor Author

Turns out we can use VariantOutputConfiguration.OutputType to check for a valid .apk:

  • VariantOutputConfiguration.OutputType.SINGLEwhen there are no splits
  • VariantOutputConfiguration.OutputType.UNIVERSAL when there are splits but universalAPK is also present

I've tried it out and it seems to work fine. AGP also uses similar logic inside of BuiltArtifactsImpl class.

@Malinskiy Malinskiy merged commit 50baac3 into MarathonLabs:main Sep 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants