问题
I have a Android project which doesn't use the NDK jet Gradle is looking for the NDK.
Either I get this Error:
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
Or I get this warning:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /opt/local/share/java/android-sdk-macosx/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Even when ANDROID_NDK_HOME and ndk.dir is unset. It there a way to built the system without those annoying messages?
回答1:
Uninstall the NDK or update your gradle plugin version. There was a bug in older versions of the plugin where it would perform an invalid sanity check on the NDK even for a Java only project. IIRC 3.2 is the fixed version.
回答2:
check your build.gradle file, if you have something like this in externalNativeBuild tag;
ndk {
abiFilters 'armeabi-v7a' ...
}
or like this;
cmake {
cppFlags "-frtti -fexceptions"
}
or maybe like this;
cmake {
path 'src/CMakeLists.txt'
}
try to remove them
回答3:
- Try to download the NDK (from: https://developer.android.com/ndk/downloads/) separately and unzip it to your prefered location, e.g.
~/Library/Android/ndk/android-ndk-r18b Open your
local.propertiesfile which probably looks like belowndk.dir=~/Library/Android/sdk/ndk-bundle sdk.dir=~/Library/Android/sdk- Change the
nkd.dirto~/Library/Android/ndk/android-ndk-r18b
Or you can try the solution from here: https://github.com/google/filament/issues/15#issuecomment-415423557
来源:https://stackoverflow.com/questions/52855364/how-to-stop-gradle-from-looking-for-the-android-ndk