Android Java代码与JNI交互 JNI访问Java构造方法(九)

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-lib
        constructor-class-lib

        SHARED

        jni/jni_constructor_class.cpp
)

  生成可关联的库链接  

为了让Java能够调用 constructor-class-lib

你可能感兴趣的:(AndroidNDK,jni,ndk,Java,C++)