NDK 编译环境配置遇到问题和解决方案
环境
AndroidStudio 3.0.1
Window10
- No toolchains found in the NDK toolchains folder for ABI with prefix
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
类似这种问题,感谢 https://www.jianshu.com/p/fd3d49c7f1f8
AndroidStudio 下载安装下来的NDK,缺少 mips64el-linux-android-4.9 和 mipsel-linux-android-4.9 工具,所以,通过 https://developer.android.google.cn/ndk/downloads/?hl=zh-cn
下载安装包,将缺少的工具拷贝进去重新编译即可
- 编译错误
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
External Native Build Issues
Build command failed.
Error while executing process F:\AndroidSDK\sdk1\cmake\3.6.4111459\bin\cmake.exe with arguments {-HD:\android_info\demo\AndroidCydiaHook-master\app -BD:\android_info\demo\AndroidCydiaHook-master\app\.externalNativeBuild\cmake\release\armeabi -DANDROID_ABI=armeabi -DANDROID_PLATFORM=android-16 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\android_info\demo\AndroidCydiaHook-master\app\build\intermediates\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=F:\AndroidSDK\sdk1\ndk-bundle -DCMAKE_CXX_FLAGS=-frtti -fexceptions -DCMAKE_TOOLCHAIN_FILE=F:\AndroidSDK\sdk1\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=F:\AndroidSDK\sdk1\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Build command failed.
Error while executing process F:\AndroidSDK\sdk1\cmake\3.6.4111459\bin\cmake.exe with arguments {-HD:\android_info\demo\AndroidCydiaHook-master\app -BD:\android_info\demo\AndroidCydiaHook-master\app\.externalNativeBuild\cmake\debug\armeabi -DANDROID_ABI=armeabi -DANDROID_PLATFORM=android-16 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\android_info\demo\AndroidCydiaHook-master\app\build\intermediates\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=F:\AndroidSDK\sdk1\ndk-bundle -DCMAKE_CXX_FLAGS=-frtti -fexceptions -DCMAKE_TOOLCHAIN_FILE=F:\AndroidSDK\sdk1\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=F:\AndroidSDK\sdk1\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
F:\AndroidSDK\sdk1\ndk-bundle\build\cmake\android.toolchain.cmake
Error:(193, 98) (include) CMakeLists.txt
<a href="openFile:F:\AndroidSDK\sdk1\ndk-bundle\build\cmake\android.toolchain.cmake">Open File</a>
Error:(193, 98) (include) CMakeLists.txt
<a href="openFile:F:\AndroidSDK\sdk1\ndk-bundle\build\cmake\android.toolchain.cmake">Open File</a>
D:\android_info\demo\AndroidCydiaHook-master\app\build.gradle
Error:ABIs [armeabi] are not supported for platform. Supported ABIs are [armeabi-v7a, arm64-v8a, x86, x86_64].
Error:ABIs [armeabi] are not supported for platform. Supported ABIs are [armeabi-v7a, arm64-v8a, x86, x86_64].
在解决这个的时候,也是去网上搜索,感谢
https://developer.baidu.com/forum/topic/show/262270 中
这个回答,但是按照这样修改还是报类似的错误,
仔细查看报的错误信息:
image.png
image.png
打开CMakeLists.txt 这个文件193行:
image.png
问题很明确了,不支持 armeabi 了,所以像之前问题回答的同学那样,修改build.gradle
多去了 armeabi,就可以编译通过了。
网友评论