新增:实现testHello()),生成libcomclientjni.so,供APP调用。

This commit is contained in:
2025-08-30 22:15:25 +08:00
commit 43f369d94b
7 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include "jni.h"
/* Header for class com_myjni_mynative_MyClientCmd */
#ifndef _Included_com_myjni_mynative_MyClientCmd
#define _Included_com_myjni_mynative_MyClientCmd
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_myjni_mynative_MyClientCmd
* Method: testHello
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_myjni_mynative_MyClientCmd_testHello
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

12
code/comclientjni.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "com_myjni_mynative_MyClientCmd.h"
#include <iostream>
#include <stdio.h>
#include <android/log.h>
#define LOG_TAG "MyClientCmd"
JNIEXPORT void JNICALL Java_com_myjni_mynative_MyClientCmd_testHello(JNIEnv *, jobject)
{
printf("this is C++ print");
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "this is C++ print");
}