I had the same problem and I just avoided cleaning or restoring the whole project until I received the latest NDK update and the problem arose again.
This is because even after deleting targets, there are still files present in app/.externalNativeBuild that are related to them.
To fix this, I removed Application.mk (which I used to set goals) and added these lines to app / build.gradle
android { defaultConfig { // ... ndk { abiFilters 'armeabi-v7a', 'arm64-v8a' // 'x86', 'x86_64' may be added } } // ... task ndkClean(type: Delete) { // remove unused archs from build cache delete fileTree('.externalNativeBuild') { exclude defaultConfig.ndk.abiFilters.collect { '**/' + it } } } tasks.findByPath(':clean').dependsOn ndkClean }
source share