Skip to content Skip to sidebar Skip to footer

Android Studio: Clang Error: Unknown Argument: '-mandroid'

I am trying to build a project with NDK and cannot get rid of this error. I searched all over the google but a similiar error is only there for Xamarin. I am using Android Studio.

Solution 1:

It seems that this related issue won't be fixed by the android-ndk folks:

Openssl (1.0.2g) adds -mandroid to the compile flags. This flag is not recognized by clang (clang38: error: unknown argument: '-mandroid'). Since it's a known gcc flag, I expect other libraries would do the same.

https://gcc.gnu.org/onlinedocs/gcc/GNU_002fLinux-Options.html provides the details for what that flag does in gcc. I'm not sure if this belongs here or as a clang issue, but I wanted to bring up this potential compatibility problem.

.

Talked with our clang folks. There isn't any point in supporting this flag in clang since the -target flag covers it already.

At some point in the (hopefully near?) future we're going to be shipping the compilers as wrappers so that we can make sure standalone toolchains, NDK build, and gradle builds all behave the same, and those wrappers could filter out unknown flags too.

Post a Comment for "Android Studio: Clang Error: Unknown Argument: '-mandroid'"