Android NDK tips - yszheda/wiki GitHub Wiki
- https://stackoverflow.com/questions/5856383/how-do-i-compile-simple-native-code-using-android-mk
- 编译且移植FFTW3到Android手机上(2)
$NDK_ROOT/build/tools/make_standalone_toolchain.py --arch=arm --force --stl=libc++ --force -v --install-dir=/opt
/android-toolchain
/opt/android-ndk-r14b/build/tools/make_standalone_toolchain.py --arch=arm --force --stl=gnustl --force -v --install-dir=/opt/android-toolchain
- https://stackoverflow.com/questions/15516275/what-s-the-difference-between-gnustl-and-stlport-in-android-ndk-development
- Android NDK支持STL的一些注意事项
- Android NDK中对STL的两种支持gnustl和stlport有什么区别?
include $(BUILD_EXECUTABLE)
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
- https://stackoverflow.com/questions/32553876/where-is-android-ndk-printf-output
- https://stackoverflow.com/questions/12159316/logging-values-of-variables-in-android-native-ndk
- https://stackoverflow.com/questions/19548055/jni-java-from-c-print-to-output
- https://stackoverflow.com/questions/10274920/how-to-get-printf-messages-written-in-ndk-application
- Official Guide
- Compiling and deploying NDK sample applications
- NDK build C++ only application
- How to compile C into an executable binary file and run it in Android from Android Shell?
- How to incorporate existing make file with Android NDK
- https://stackoverflow.com/questions/7679363/android-build-system-neon-and-non-neon-builds
- USING NEON WITH NDK-BUILD
adb logcat | ./ndk-stack -sym ~/<path>/obj/local/armeabi
ndk-build NDK_PROJECT_PATH=<proj>
You need to specify 3 things. NDK_PROJECT_PATH - the location of your project NDK_APPLICATION_MK - the path of the Application.mk file APP_BUILD_SCRIPT - the path to the Android.mk file
These are needed to override the default values of the build script, which expects things to be in the jni folder.
When calling ndk-build use ndk-build NDK_PROJECT_PATH=/path/to/proj NDK_APPLICATION_MK=/path/to/Application.mk
In Application.mk add APP_BUILD_SCRIPT := /path/to/Android.mk
- https://stackoverflow.com/questions/14156596/ndk-cant-find-the-application-directory
- Android问题集锦之四十:Android NDK: Could not find application project directory
- https://stackoverflow.com/questions/25868989/build-android-shared-lib-using-ndk-build-without-have-jni-folder
When using armeabi-v7a-hard
:
LOCAL_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
LOCAL_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard
- https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android
- OpenBLAS issue: Android fails to run basic example compiled with openblas (in emulator)
- https://stackoverflow.com/questions/19256461/android-ndk-eabi-how-to-make-ndk-know-to-use-hard-fp
- https://github.com/sh1r0/caffe-android-lib/issues/108
Use pre-compiled static library in Android.mk
:
LOCAL_PATH := $(call my-dir)/..
include $(CLEAR_VARS)
LOCAL_MODULE := openblas
# ld: fatal error: jni/../jni/../: pread failed
# LOCAL_SRC_FILES += $(LOCAL_PATH)/lib/libopenblas.a
LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/libopenblas.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := openblas
- https://stackoverflow.com/questions/5463518/android-ndk-link-using-a-pre-compiled-static-library
- https://stackoverflow.com/questions/18983037/include-prebuilt-static-library
- https://stackoverflow.com/questions/10106965/how-to-link-any-library-in-ndk-application
- Android NDK: Link static library to your JNI library