🔥 Android Studio 版本 🔥
🔥 基础类型数据的转换 🔥
定义传递基础数据类型到JNI的函数
package com.cmake.ndk1.jni; public class JNIBasicType{ static{ System.loadLibrary("native-lib"); } public native int callNativeInt(int num); public native byte callNativeByte(byte b); public native char callNativeChar(char ch); public native short callNativeShort(short sh); public native long callNativeLong(long l); public native float callNativeFloat(float f); public native double callNativeDouble(double d); public native boolean callNativeBool(boolean b); };
创建callNativeInt 提供给Java调用
#include <base.h> #include <jni.h>