Android Java代码与JNI交互 JNI访问Java类方法 (七)

Android Studio 版本   

  创建包含JNI的类 JNIAccessMethod.java

package com.cmake.ndk1.jni;

import com.cmake.ndk1.model.Animal;

public class JNIAccessMethod {
    static {
        System.loadLibrary("access-method-lib");
    }

    public native void accessInstanceMethod(Animal animal);

    public native void accessStaticMethod(Animal animal);
}

  Java方法对应Native层方法名称

 * |Java                   |JNI                   |
 * |String fun()           |()Ljva/lang/String;   |
 * |long f(int i,Class c); |(ILjava/lang/Class;)J |
 * |String(byte[] bytes);  |([B)V  

你可能感兴趣的:(AndroidNDK,java,jni,ndk,c,c++)