I am getting this error:
java.lang.NoSuchMethodError: no non-static method "Ljava/lang/AssertionError;.(Ljava/lang/String;)V"
jclass clazz = env->FindClass( "java/lang/AssertionError" );
env->ThrowNew( clazz, "Test Assertion" );
Note: env is JNIEnv*
Any thoughts? I see that AssertionError exists. I am seeing this on Android Lollipop only. It seems to be fine on android 4.4.2.
Try
jclass clazz = env->FindClass( "java/lang/AssertionError" );
env->ThrowNew( clazz, "Test Assertion" );
I don't know where exceptionClass comes from, but you didn't set it here.
java.lang.AssertionError
doesn't have the constructor mentioned in the error message. So you can't use ThrowNew(),
which relies on that.
You'll have to construct the exception yourself and use Throw().
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.