How to fix android studios 2.3 NDK bug?

后端 未结 11 536
感情败类
感情败类 2020-12-05 16:51

I\'m assuming it\'s a bug since I didn\'t have any problems until the new update. So I cant use the gradle console to debug my app because I have this warning -

相关标签:
11条回答
  • 2020-12-05 17:40

    I was able to prevent this annoying message; here is what worked for me.

    BACKGROUND:

    1. I am not using the NDK at all, and had never installed the NDK.

    2. However, as mentioned in another answer here by xsveda, this is a Gradle bug that is documented here:

      https://code.google.com/p/android/issues/detail?id=228424

      and so even the "NDK-innocent" may become its victims.

    3. The problem is that Gradle is computing the location of an NDK folder by just tacking on the string "/ndk-bundle" to the SDK folder location, even if you have never installed the NDK.

    4. After establishing this false expectation of an NDK folder existing in a particular location, each time you build, Gradle gives you a warning that you're "missing" that folder. This is just a warning and does not prevent your build from completing, but it is annoying.

    HOW I STOPPED THE ANNOYING MESSAGE:

    Since disk space is cheap, and my time is precious to me, I humored this bug by installing the NDK, even though I do not intend to use it.

    To do this, you can go to:

    File -> Project Structure -> SDK Location

    and look in the Android NDK location field. If you have not installed the NDK, this field will be empty.

    In that case, below that field will be a link for installing the NDK. Click on that link and install it. It takes a few minutes.

    Once the installation completes and you close the installation progress dialog, the location of the NDK will be automatically written into the Android NDK location field. This will be something like:

    C:\dev\astudiosdk\ndk-bundle

    Click the OK button and build again. The error disappears.

    Note that you may be able to just type the expected folder into this field; I did not try that. But I don't know whether that might cause some other problems, especially if you eventually decide to actually use the NDK.

    0 讨论(0)
  • 2020-12-05 17:40

    Sounds like maybe updating SDK from Android Studio IDE could help

    Steps are:

    1. Go to Tools (top-menu item) > Android > SDK Manager
    2. Click SDK Tools tab
    3. Scroll down to the NDK checkbox update-option

    Screen shots here: How to update Android NDK in place?

    0 讨论(0)
  • 2020-12-05 17:49

    This type of error statement are:-

    1. NDK is missing a "platforms" directory.
    2. How to set ANDROID_NDK_HOME so that Android Studio does not ask for ndk location?

    Solution:

    Open your build.gradle and here you are see two gradle path like: classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.android.tools.build:gradle:2.2.0'

    You can remove one of those classpath and keep only one Classpath.

    Clean the project gradlew clean

    This is working for me never require to set the ndk path or the ndk setting.

    Android Studio NDK 2.3 BUG

    0 讨论(0)
  • 2020-12-05 17:49

    If you cannot build your project while releasing APK

    That warning you see is just a warning. Whats funny is that its most likely you left some languages strings.xml without required names. Or some of localized strings-.xml has unwanted characters like " ' " which should be leplaced with e.g " \' " . Overall it can be related to your app resources. Recheck them carefully first.

    0 讨论(0)
  • 2020-12-05 17:51

    Go to Gradle Scripts then to local.properties and set the SDK , and NDK locations properly, in my case the setting is:

    ndk.dir=F:\AndroidSDK\ndk-bundle sdk.dir=F:\AndroidSDK

    0 讨论(0)
提交回复
热议问题