优化:项目结构、命名
This commit is contained in:
@ -6,12 +6,12 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../code/
|
||||
LOCAL_LDLIBS := -llog -lc
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
../code/comclientjni.cpp
|
||||
../code/mynative.cpp
|
||||
|
||||
LOCAL_CFLAGS := -D__OS_ANDROID
|
||||
LOCAL_CPPFLAGS += -std=c++11 -android
|
||||
|
||||
LOCAL_MODULE := comclientjni
|
||||
LOCAL_MODULE := mynative
|
||||
|
||||
# LOCAL_LDFLAGS := -Wl,--hash-style=both
|
||||
|
||||
|
||||
21
code/com_myjni_api_NativeCommand.h
Normal file
21
code/com_myjni_api_NativeCommand.h
Normal file
@ -0,0 +1,21 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_myjni_api_NativeCommand */
|
||||
|
||||
#ifndef _Included_com_myjni_api_NativeCommand
|
||||
#define _Included_com_myjni_api_NativeCommand
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_myjni_api_NativeCommand
|
||||
* Method: testHello
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_myjni_api_NativeCommand_testHello
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,21 +0,0 @@
|
||||
/* 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
|
||||
@ -1,12 +0,0 @@
|
||||
#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");
|
||||
}
|
||||
12
code/mynative.cpp
Normal file
12
code/mynative.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "com_myjni_api_NativeCommand.h"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "MyClientCmd"
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_myjni_api_NativeCommand_testHello(JNIEnv *, jobject)
|
||||
{
|
||||
printf("this is C++ print");
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "hello, this is C++ print");
|
||||
}
|
||||
Reference in New Issue
Block a user