1.未設置NDK的路徑
Error:Execution failed for task ':library:ndkBuild'. > A problem occurred starting process 'command 'null/ndk-build''
配置NDK的的安裝路徑即可。
1)設置環境變量:新增ANDROID_NDK_HOME
鍵值為Android NDK安裝目錄,在PATH末尾增加;%ANDROID_NDK_HOME%
。
或者2)在AS的project structure設置,如下圖:
2. 調用的ndk-build命令不對
Error:Execution failed for task ':library:ndkBuild'.> A problem occurred starting process 'command 'D:\androidDev\android-ndk-r10e/ndk-build''
在stackoverflow上找到原因,build.gradle文件中
taskndkBuild(type: Exec,description:'Compile JNI source via NDK') { defndkDir =project.plugins.findPlugin('com.android.library').sdkHandler.ndkFolder workingDir"$projectDir/src/main/jni" commandLine"$ndkDir/ndk-build" }
commandLine"$ndkDir/ndk-build"這一行windows下應該用ndk-build.cmd(項目中有遇到)
3. 找不到boost庫文件
項目Readme中有說明
Manual Build Make sure$ANDROID_NDK_HOMEis correctly set to the root directory of your NDK installation. Also, if Boost lives in a non-standard directory (or you're on Windows) you'll need to set$BYPASS_INCLUDE_PATH to its parent directory.
設置環境變量:新增BYPASS_INCLUDE_PATH
鍵值為boost的安裝目錄,在PATH末尾增加;%BYPASS_INCLUDE_PATH%
。