How to fix android studios 2.3 NDK bug?

Ryder Thacker 08/20/2017. 9 answers, 13.558 views
android android android-ndk android-ndk

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 -

"Configuration on demand is an incubating feature. 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 C:\Users\Emily Thacker\AppData\Local\Android\Sdk\ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning."

I am pretty sure I am not using NDK and I dont see how I can fix this problem here is my local.properties

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C\:\\Users\\Emily Thacker\\AppData\\Local\\Android\\Sdk

Also I do not see a ANDROID_NDK_HOME file in my directory.

2 Comments
Harshit Agrawal 03/08/2017
which version of gradle are you using?
3 Ryder Thacker 03/08/2017
I'm using version 3.3.

9 Answers


xsveda 03/16/2017.

It is an Android Gradle plugin bug, already reported here: https://code.google.com/p/android/issues/detail?id=228424

1 comments
3 Matt 06/20/2017
The bug report entry (issuetracker.google.com/issues/37127636#comment26) states that the warning will be fixed in gradle plugin version 2.4 and above.

Carl 04/24/2017.

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.


Harshit Agrawal 03/09/2017.

You can give it a try :

There is a checkbox for it in android studio already.

Android Studio -> Preferences -> Compiler -> Gradle -> Command-line Options

enter image description here

4 comments
2 Ryder Thacker 03/08/2017
Still not working.
Harshit Agrawal 03/09/2017
This probably happens because of Fast Build Process
3 Ryder Thacker 03/10/2017
Configure on demand was already checked for me.
Harshit Agrawal 03/10/2017
@RyderThacker uncheck it and than sync gradle again

gnB 05/23/2017.

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?

1 comments
CorayThan 06/26/2017
That doesn't fix the issue, that just downloads the NDK, which you probably don't have any good reason to download.

Alex Cohn 03/21/2017.

You should not use a directory path with spaces for Android SDK. As an easy cure you can manually change

sdk.dir=C:/Users/EMILYT~1/AppData/Local/Android/Sdk

You don't need to install NDK.


Oleksandr 07/26/2017.

Fixed this issue by removing an empty ndk-bundle folder from SDK root folder (have no idea why and when it has appeared):

ndk-bundle folder in android SDK folder

Here is the explanation why it helps from the issue on Android bug tracker:

For anyone still experience this issue on plugin 3.0.0-alpha1 or later. Please file a new bug and try to answer all question in #33. We need more information to debug the problem and adding comments to a closed bug is an easy way for it to get lost.

To give a bit of background, the plugin checks whether the NDK directory is valid. Most likely, you are not using NDK. We automatically assume it's in {sdk}/ndk-bundle. It will be ignored if {sdk}/ndk-bundle does not exist. If you see 'NDK is missing a "platforms" directory.', it means there is an {sdk}/ndk-bundle, but not a {sdk}/ndk-bundle/platforms directory. This means you have a corrupted NDK for some reason. It is safe to just remove {sdk}/ndk-bundle if you are not using it.


davenpcj 08/17/2017.

For me, the NDK error turned out to be a false diagnosis. This error occurred when gradle threw a ClassNotFound exception on java.io.UncheckedIOException class.

Although the class is defined in Java 8, it was not included in the JDK 1.8.0u51 (or presumably earlier versions) which I had installed.

Updating the JDK and removing the 1.8.0u51 version resolved the issue.


RagsB 06/21/2017.

Just install the Android NDK.

That fixed my error and warning!

https://i.stack.imgur.com/Lsu8E.png

  1. Go to Tools -> Android -> SDK Manager
  2. Click SDK Tools
  3. CHECK NDK
  4. Apply and quit.
1 comments
RagsB 06/21/2017
well, Here are the steps to install NDK, 1. GO to tools.2.Android 3.SDK Manager.3. SRK tools 4. CHECK NDK Click Apply and then OK! 5.Rebuild

Lalit Baghel 04/14/2017.

I am gives a solution which is work for me. 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?

Soultion: You are trying more solution While you are not require NDK

please open your build.gradle and here you are used two gradle path like:-

classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.android.tools.build:gradle:2.2.0'

here you can remove a class path and use only one

classpath of gradle and then clean the project This is working for me never requre to set the ndk path or the ndk setting.

Android Studio NDK 2.3 BUG

2 comments
Patrick Robert Shea O'Connor 05/24/2017
This appears to be an issue where you tried to use two version of gradle, and you opted to keep 2.2.0, which "fixed" the bug. What your suggesting is to downgrade to 2.2.0, which isn't a solution to using 2.3 and working around this bug.
Lalit Baghel 06/02/2017
use any installed verion of gradle like classpath 'com.android.tools.build:gradle:2.2.0'

Related questions

Hot questions

Language

Popular Tags