Skip to content Skip to sidebar Skip to footer

How Do I Tell Android Studio To Use GCC 4.9 With CMake?

I'm using NDK r12 with Android Studio 2.2. I need CMake to use GCC 4.9 instead of Clang to build our code base, however even if I provide the following it still uses clang: android

Solution 1:

Split your arguments string into one string per argument:

arguments '-DBUILD_TESTING=OFF','-DANDROID_TOOLCHAIN=gcc'

I don't know if it's possible to explicitly specify version 4.9 of GCC ("gcc-4.9" didn't work). However, that's redundant anyway since GCC 4.8 was removed in NDK r11, so GCC 4.9 is now the only version of GCC included in the NDK, and ANDROID_TOOLCHAIN=gcc therefore implicitly means GCC 4.9.


Solution 2:

It looks that it's impossible now and GCC toolchaing is dropped.

I get this error when trying to set ANDROID_TOOLCHAIN=gcc:

CMake Error at D:/Android/ndk-bundle/build/cmake/android.toolchain.cmake:169 (message): GCC is no longer supported. See https://android.googlesource.com/platform/ndk/+/master/docs/ClangMigration.md


Post a Comment for "How Do I Tell Android Studio To Use GCC 4.9 With CMake?"