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
Context: dotnet/android#9931
Context: dotnet/android#9931 (comment)
The attempted integration test crashed!
F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.ClassNotFoundException: Didn't find class "crc641855b07eca6dcc03.MyCb" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system/product/lib64, /system/lib64, /system/product/lib64]]
F mono-rt : at Java.Interop.JniEnvironment.Types.TryFindClass(String classname, Boolean throwOnError)
F mono-rt : at Java.Interop.JniEnvironment.Types.FindClass(String classname)
F mono-rt : at Java.Interop.JniType..ctor(String classname)
F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods..ctor(Type declaringType)
F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods.GetConstructorsForType(Type declaringType)
F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance(String constructorSignature, Type declaringType, JniArgumentValue* parameters)
F mono-rt : at Java.Lang.Object..ctor()
F mono-rt : at Java.InteropTests.MyCb..ctor()
F mono-rt : at Java.InteropTests.JnienvTest.<>c__DisplayClass29_0.<DoNotLeakWeakReferences>b__1()
F mono-rt : at System.Threading.Thread.StartHelper.Callback(Object state)
F mono-rt : at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
F mono-rt : --- End of stack trace from previous location ---
F mono-rt : at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
F mono-rt : --- End of managed Java.Lang.ClassNotFoundException stack trace ---
F mono-rt : java.lang.ClassNotFoundException: Didn't find class "crc641855b07eca6dcc03.MyCb" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system/product/lib64, /system/lib64, /system/product/lib64]]
F mono-rt : at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
F mono-rt : at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
F mono-rt : at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Perhaps unsurprisingly, we need to provide the system ClassLoader
in order to load types from outside the default "classpath", which is
why we used `ClassLoader.loadClass()` in the first place.
Instead of `Class.forName()`, use the
[`Class.forName(String name, boolean initialize, ClassLoader loader)`][0]
overload, so that we can provide a `ClassLoader` instance.
This *should* fix the crash.
[0]: https://developer.android.com/reference/java/lang/Class#forName(java.lang.String,%20boolean,%20java.lang.ClassLoader)
0 commit comments