1.android环境的可执行文件的生成
所谓的android下的可执行文件,其实就是一般的c/c++代码使用NDK编译出来的应用程序。它和linux下用gcc编译出来的程序和windows系统下的.exe文件是一样的。要将代码编译成可执行文件只需要将编译so的include $(BUILD_SHARED_LIBRARY)改成include $(BUILD_EXECUTABLE)就行。
Main.cpp
#include <iostream>
#include <android/log.h>
using namespace std;
#define LOG_TAG "JNI_LOG"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
int main(int argc, char **argv)
{
LOGI("NativeFile Begin!");
LOGI("This is a Test!");
LOGI("NativeFile End!");
return 0;
}
Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
Main.cpp
LOCAL_MODULE :