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

Can't specify --min-api to d8 #319

Open
ahumesky opened this issue Jan 9, 2020 · 1 comment
Open

Can't specify --min-api to d8 #319

ahumesky opened this issue Jan 9, 2020 · 1 comment
Labels
P2 Priority P2

Comments

@ahumesky
Copy link
Collaborator

ahumesky commented Jan 9, 2020

Bazel uses CompatDexBuilder while we remove the remaining dex support code:

https://github.com/bazelbuild/bazel/blob/d1ff8c2d15454444094f94765d4b57ce0232bb51/tools/android/BUILD.tools#L42

and CompatDexBuilder appears to hardcode the min api level:

https://r8.googlesource.com/r8/+/41d2ea5adff39b579b297219310199fd566e778b/src/main/java/com/android/tools/r8/compatdexbuilder/CompatDexBuilder.java#169

@ahumesky ahumesky added the P2 Priority P2 label Dec 3, 2020
@ahumesky
Copy link
Collaborator Author

There's now an experimental attribute on android_binary called min_sdk_version available with 6.0.0 which will set the API level to use for dexing and desugaring:
https://github.com/bazelbuild/bazel/blob/534089ed10a253b31c499a284079f52a92bc0347/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java#L575-L583

It's experimental because the implementation can cause memory and caching issues, e.g. if two apps with different min_sdk_version values depends on the same android_library, then that library gets built twice.

I'll leave this issue open for now for folks to report any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority P2
Projects
None yet
Development

No branches or pull requests

1 participant