错误1
Task ‘assembleDebug’ not found in project ‘:app’."
貌似是我执行了README文件里要求的$ echo sdk.dir=$HOME/Android/Sdk > local.properties
导致的
将Android Studio左下角的Build Variants的Debug设置改成Release,再改回Debug,设置会重新变正确。
错误2
Execution failed for task ':jni:externalNativeBuildDebug'.
> Build command failed.
Error while executing process /Users/brucezhu/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/brucezhu/Code/mupdfDemo/jni/libmupdf/platform/java/Android.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/brucezhu/Code/mupdfDemo/jni/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/brucezhu/Code/mupdfDemo/jni/build/intermediates/ndkBuild/debug/lib -j4 mupdf_java}
尝试方法1:将项目所在路径中的所有空格、下滑线去掉
尝试方法2:安装及配置 NDK 和 CMake (Preference->Android SDK -> SDK Tools)
尝试方法3:命令行执行make generate
错误3
No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
原因: 在本地Android存放的NDK路径/Users/brucezhu/Library/Android/ndk/23.1.1119620/toolchains中,添加缺少的“arm-linux-androideabi”文件
解决:在Preference->Android SDK -> SDK Tools中,勾选“Show Package Detail”, 发现目前用的NDK版本是23.1.1119620, 改选为22.0.7026061重新下载。
编绎成功