🔥 Android Studio 版本 🔥
🔥 创建包含JNI的类 JNIException.java 🔥
package com.cmake.ndk1.jni; public class JNIException { static { System.loadLibrary("exception-lib"); } public native void nativeInvokeJavaException(); public native void nativeThrowException() throws IllegalArgumentException; private int operation() { return 2 / 0; } }
🔥 配置动态库名称 🔥
add_library( #动态库名称 exception-lib exception-lib SHARED jni/jni_exception.cpp )