Henry Case bcd12b6b42 | пре 5 година | |
---|---|---|
.. | ||
hello_world | пре 5 година | |
README.md | пре 5 година |
Create following directory structure:
hello_world/
jni/
libs/
In the jni
directory create two files
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# give module name
LOCAL_MODULE := hello_world
# list your C files to compile
LOCAL_SRC_FILES := test.c
LOCAL_CFLAGS = -fPIE LOCAL_LDFLAGS = -fPIE -pie
include $(BUILD_EXECUTABLE)
```
test.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello World\n");
return 0;
}
Export PATH to NDK
export PATH=/usr/local/softs/android-ndk-r10e:$PATH
Go to jni
directory
Call ndk-build
Result should be in hello_world/libs/armeabi/hello_world