Bug: android_library neverlink leaks native code (and maybe more?) #13216
Labels
not stale
Issues or PRs that are inactive but not considered stale
P2
We'll consider working on this in future. (Assignee optional)
team-Android
Issues for Android team
type: bug
Description of the problem / feature request:
android_library has a neverlink option. Neverlink is supposed allow the library use the library during compilation but not bundle it or its dependencies into the APK--analogous to the (better named?), option cc_import.system_provided. From the (linked) android_library docs:
However, some files leak through neverlink and are bundled into the APK.
As an example, .so files from android_libraries JNI code are bundled into the final APK, regardless of neverlink.
The following TODO makes me wonder if the issue is resources more broadly? Can't see the Buganizer details bc I'm (no longer) a Googler.
bazel/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java
Line 138 in f9db4fb
Neverlink does, however, work for Java code--at least judging from the change in dex size. I'm wondering if, perhaps, neverlink got brought over form java_library, but wasn't properly generalized to android_libraries?
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Just grab the NDK example, add neverlink, and give it a go.
What operating system are you running Bazel on?
macOS
What's the output of
bazel info release
?4.0.0
The text was updated successfully, but these errors were encountered: