/********************************************************************************** * using Android Stu Dio's own NDK compiled JNI * Description: * Save yourself the additional download NDK, compile Jni, trouble. * 2017-4-30 Shenzhen Longhua gen Zengjianfeng ************************************** *******************************************/First, reference documents:1. NDK Environment Building-Windows article http://Www.jianshu.com/p/708e6bf68ae9 2. MistakeinchDocumentation/error message?https://github.com/android-ndk/ndk/issues/264 3. Undefined reference to ' __android_log_print appears when compiling a module'http//bbs.csdn.net/topics/360020076Second, error:1. Error 1:1. Error symptom: D:\zengjf\SourceCode\Android\android_app\Test>ndk-Build C:/users/zengjf/appdata/local/android/sdk/ndk-bundle/build//.. /build/core/build-binary.mk:687:android ndk:module ZENGJF depends on undefined modules:android_runtime nativehelper cu TILs utils LogC:/users/zengjf/appdata/local/android/sdk/ndk-bundle/build//.. /build/core/build-binary.mk:701: * * * Android ndk:aborting (set App_allow_missing_deps=true to allow MISSING dependencies). Stop.D:\zengjf\SourceCode\Android\android_app\Test>2. Workaround1. C:\Users\zengjf\AppData\Local\Android\Sdk\ndk-bundle\build\core\build-binary.mk2. Modify content: ... ifdef undefined_libs $ (call __ndk_warning,module $ (local_ MODULE) depends on undefined modules: $ (undefined_libs)) # https://github.com/android-ndk/ndk/issues/208# Ndk-build didn'T used to fail the build for a missing dependency. this# seems to all been the behavior, so there's a good chance that# there is builds outThere that depend on ThisBehavior ( asof right now, # anythingusingLibc++ on ARM have Thisproblem because of Libunwind). # # bydefaultWe'll abortinch ThisSituation because This isSo completely # broken. A user may define App_allow_missing_deps to"true" inchtheir # application.mk or on the command line to revert to the old, broken # is Havior. App_allow_missing_deps=true //Add this lineIfneq ($ (app_allow_missing_deps),true) $ (Call __ndk_error,aborting (Setapp_allow_missing_deps=trueTo allow missing dependencies)) endif endif ...2. Error 2:1. Error symptom: Undefined references to ' __android_log_print'Follow 2. Workaround: Add local_ldlibs to the Android.mk file+ =-llog can be
Compiling JNI with the NDK that comes with Android studio