in remote_config/testapp/src/android/android_main.cc [152:182]
void CheckJNIException() {
JNIEnv* env = GetJniEnv();
if (env->ExceptionCheck()) {
// Get the exception text.
jthrowable exception = env->ExceptionOccurred();
env->ExceptionClear();
// Convert the exception to a string.
jclass object_class = env->FindClass("java/lang/Object");
jmethodID toString =
env->GetMethodID(object_class, "toString", "()Ljava/lang/String;");
jstring s = (jstring)env->CallObjectMethod(exception, toString);
const char* exception_text = env->GetStringUTFChars(s, nullptr);
// Log the exception text.
__android_log_print(ANDROID_LOG_INFO, FIREBASE_TESTAPP_NAME,
"-------------------JNI exception:");
__android_log_print(ANDROID_LOG_INFO, FIREBASE_TESTAPP_NAME, "%s",
exception_text);
__android_log_print(ANDROID_LOG_INFO, FIREBASE_TESTAPP_NAME,
"-------------------");
// Also, assert fail.
assert(false);
// In the event we didn't assert fail, clean up.
env->ReleaseStringUTFChars(s, exception_text);
env->DeleteLocalRef(s);
env->DeleteLocalRef(exception);
}
}