My NDK project fails to compile with a CPU architecture-related issue

Most likely, you have NDK r17 installed, which does not support armeabi anymore. Your gradle plugin is not aware of this recent change. You must upgrade: in build.gradle, you should have

buildscript { dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
} }

and in gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

But even after upgrade, your build.gradle most likely lacks the abiFilters statement, and therefore your project build is slower and APK larger than necessary.

You probably only need on ABI in your APK,

android { defaultConfig { ndk {
    abiFilters 'armeabi-v7a'
} } }

I got this error recently - the cause was a mystery and still is. I reinstalled everything, but I could not get my project to Clean.

In the end I manually deleted the app/build and app/.externalNativeBuild folders, and the project rebuilt fine, and I was then able to run Clean without errors again.