🔥 Android Studio 版本 🔥
🔥 创建包含JNI相关函数类 JNIConstructorClass.java 🔥
package com.cmake.ndk1.jni;import com.cmake.ndk1.model.Animal;public class JNIConstructorClass {static {System.loadLibrary("constructor-class-lib");}public native Animal invokeAnimalConstructors();public native Animal allocObjectConstructor(); }
🔥 配置动态库名称 🔥
add_library(#动态库名称 constructor-class-libconstructor-class-libSHAREDjni/jni_constructor_class.cpp )
🔥 生成可关联的库链接 🔥
为了让Java能够调用 constructor-class-lib