Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
di...@google.com <di...@google.com>
jg...@google.com <jg...@google.com> #2
Looks like ContextWrapper.getClassLoader()
is throwing an NPE.
java_vm_ext.cc:591] JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.ClassLoader android.content.Context.getClassLoader()' on a null object reference
java_vm_ext.cc:591] at java.lang.ClassLoader android.content.ContextWrapper.getClassLoader() (ContextWrapper.java:176)
java_vm_ext.cc:591] at java.lang.ClassLoader com.android.tools.agent.app.inspection.AppInspectionService.findClassLoader() (AppInspectionService.java:435)
java_vm_ext.cc:591] at void com.android.tools.agent.app.inspection.AppInspectionService.<init>(long) (AppInspectionService.java:88)
java_vm_ext.cc:591] at com.android.tools.agent.app.inspection.AppInspectionService com.android.tools.agent.app.inspection.AppInspectionService.createAppInspectionService() (AppInspectionService.java:-2)
java_vm_ext.cc:591] at com.android.tools.agent.app.inspection.AppInspectionService com.android.tools.agent.app.inspection.AppInspectionService.instance() (AppInspectionService.java:55)
java_vm_ext.cc:591]
java_vm_ext.cc:591] in call to FindClass
an...@google.com <an...@google.com> #3
I added NPE protection that resorts to a "safe" way to get a classloader.
Description
Relates to this issue on cashapp/paparazzi:https://github.com/cashapp/paparazzi/issues/622
In particular, this comment:https://github.com/cashapp/paparazzi/issues/622#issuecomment-1551872561
Doing a naive search across layoutlib sources for hamcrest shows nothing:
Doing a naive search across layoutlib sources for junit (which pulls in hamcrest as a transitive dependency) shows references in test sources (to be expected):
Is it possible that layoutlib is accidentally bundling its test dependencies in the binary?