0.头文件引入
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include<jni.h>
#include"platform/android/jni/JniHelper.h" //引不到JniHelper.h
#include "JniHelper.h" //编译不能通过
#include<android/log.h>
#endif
1.传递一个int类型的参数
CaddCall类
public native static int retGooglePlay(int pResult); //通过CaddCall. retGooglePlay(2)就能调用
org_play_test包名、CaddCall类名、retGooglePlay方法名、pResult参数
extern "C" {
JNIEXPORT void JNICALL Java_org_play_test_CaddCall_retGooglePlay(JNIEnv* env,
jobject thiz, jint pResult) {
int aa = pResult;
char buf[10];
sprintf(buf, "%d", aa);
std::string b = buf;
CCMessageBox("12ss3", b.c_str());
}
}