How to stop gradle from looking for the Android NDK?

浪子不回头ぞ 提交于 2019-12-24 23:08:44

问题


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:


  1. 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
  2. Open your local.properties file which probably looks like below

    ndk.dir=~/Library/Android/sdk/ndk-bundle
    sdk.dir=~/Library/Android/sdk
    
  3. Change the nkd.dir to ~/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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!