You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mobile install fails to load native libraries embedded in the incremental APK while using mobile-install.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Use mobile-install to build and install an Android app that includes an AARs containing native libraries. The application will crash at runtime when you load the library using System#loadLibrary.
Have you found anything relevant by searching the web?
The incremental class loader being injected into the application via StubApplication doesn't fall back to the APK when BaseDexClassLoader#findLibrary is called. Iterating over and calling BaseDexClassLoader#findLibrary on the parent class loaders in DelegateClassLoader does work around the problem:
The runtime Stacktrace from trying to load a native library
2021-07-09 09:46:26.999 24078-24078/? E/AndroidRuntime: FATAL EXCEPTION: main Process: cm.ben.android.bazel.bug, PID: 24078 java.lang.UnsatisfiedLinkError: com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/local/tmp/incrementaldeployment/cm.ben.android.bazel.bug/dex/incremental_classes1.dex"],nativeLibraryDirectories=[/data/user/0/cm.ben.android.bazel.bug/lib, /system/lib64, /system_ext/lib64]]] couldn't find "libbugsnag-ndk.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1083) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at cm.ben.android.bazel.bug.DemoApplication.onCreate(DemoApplication.java:10) at com.google.devtools.build.android.incrementaldeployment.StubApplication.onCreate(StubApplication.java:572) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6719) at android.app.ActivityThread.access$1300(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7664) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
The text was updated successfully, but these errors were encountered:
Description of the problem / feature request:
Mobile install fails to load native libraries embedded in the incremental APK while using mobile-install.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Use
mobile-install
to build and install an Android app that includes an AARs containing native libraries. The application will crash at runtime when you load the library usingSystem#loadLibrary
.What operating system are you running Bazel on?
MacOs Catalina 10.15.7
What's the output of
bazel info release
?release 4.1.0
Have you found anything relevant by searching the web?
The incremental class loader being injected into the application via
StubApplication
doesn't fall back to the APK whenBaseDexClassLoader#findLibrary
is called. Iterating over and callingBaseDexClassLoader#findLibrary
on the parent class loaders inDelegateClassLoader
does work around the problem:Any other information, logs, or outputs that you want to share?
The incremental APK does have the native libraries in it
Using
build
instead ofmobile-install
works as expected:The runtime Stacktrace from trying to load a native library
The text was updated successfully, but these errors were encountered: