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

Detect AAR minSdkVersion and pass it to dx #311

Merged
merged 2 commits into from
Jul 16, 2020
Merged

Conversation

benjamin-bader
Copy link
Collaborator

This is such a hack, but then so is AAR method counting so whatevs

Fixes #310

var tempFile: File? = null

for (entry in entries) {
if (entry.name == "AndroidManifest.xml") {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but this would only work if the minSdk is defined in the manifest rather than in the build.gradle(.kts) where it is often defined, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build files (build.gradle and build.gradle.kts) are used to assemble an .aar archive, but are not included in it. The values you define in those build files are placed into the manifest file, where we can reliably read them.

CI is failing here because evidently, the version of dx used in CI doesn't have the --min-sdk-version option, so now I need to figure out when that flag was added, and conditionally use that option only if it exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you doubt this, check our integration tests. In integration/lib/build.gradle you'll certainly find the minSdkVersion defined there, and not in ./src/main/AndroidManifest.xml.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, excellent point - I'm not terribly used to working with pre-built archives so I overlooked that. I'll take a look at the new build you published and see if it works. Thanks for being so quick to put in this fix!

@benjamin-bader benjamin-bader merged commit 3caa2b7 into master Jul 16, 2020
@benjamin-bader benjamin-bader deleted the pass-min-sdk-to-dx branch July 16, 2020 16:53
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.

Kotlin static interface method
2 participants