After updating Android Studio NDK, I can't build my app, due to an error related to CMAKE (my application uses one c++ file). Here are the error lines:
Build command failed.
Error while executing process C:\Users\AnimallTag\AppData\Local\Android\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Projetos\Git\at65\app -BC:\Projetos\Git\at65\app\.externalNativeBuild\cmake\debug\mips -GAndroid Gradle - Ninja -DANDROID_ABI=mips -DANDROID_NDK=C:\Users\AnimallTag\AppData\Local\Android\sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Projetos\Git\at65\app\build\intermediates\cmake\debug\obj\mips -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\AnimallTag\AppData\Local\Android\sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\AnimallTag\AppData\Local\Android\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_PLATFORM=android-14}
(include) CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Any suggestion to help me solve that problem? Maybe a way I can downgrade NDK or a Android Studio previous version I can install...
I managed to fix it. One thing I noticed was the changelog of android NDK, and it says there is no more support for armeabi, MIPS and MIPS64 ABIs, so I filtered ABIs in my build.gradle file:
android {
defaultConfig {
externalNativeBuild {
cmake {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
}
}
}
After that I synchronized gradle and Android Studio prompted me to update Gradle, and I did. The app can now be deployed, but I'm not sure what fixed it. Apparently the error was not related to CMAKE_C_COMPILER neither CMAKE_CXX_COMPILER, it was happening somewhere else and when the build failed, it wasn't able to find those variables. Maybe this can help someone too...
After NDK Recent update CMAKE was breaking
Nothing Worked but I downgraded NDK by downloading NDK from https://developer.android.com/ndk/downloads/older_releases
and changed NDK DIR PATH in local.properties to
ndk.dir=/Users/kathan/Library/Android/sdk/android-ndk-r17c
And just Sync Gradle.
Worked like Charm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With