我正在尝试从 JNI 中引发异常,但 Activity 因以下 logcat 错误而崩溃:
WARNING: exception class 'Lthis/is/package/A$B;' missing constructor (msg='' kind=0
java.lang.RuntimeException: re-throw on exception class missing constructor
我的代码与此类似:
在 JAVA 中:
package this.is.package;
public class A {
public class B extends Exception {
public B () { super (); }
public B ( String s ) { super ( s ); }
public B ( Throwable t ) { super ( t ); }
public B ( String s, Throwable t ) { super ( s, t ); }
}
}
在 JNI 中:
(*env)->ThrowNew ( env, (*env)->FindClass ( "this/is/package/A$B" ), "" );
我该如何解决?