Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix android studios 2.3 NDK bug?

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.

like image 694
Ryder Thacker Avatar asked Mar 08 '17 21:03

Ryder Thacker


People also ask

How do I remove NDK?

Go to the "SDK Tools" page in the "Android SDK" menu. REMEMBER to check the checkbox "Show Package Details" at the lower right corner. You'll see all the NDK's you had installed, Un-check the NDK you'd like to uninstall and click "OK" at the bottom right to uninstall the selected NDK.

Does Android Studio install NDK?

Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory. To install CMake and the default NDK in Android Studio, do the following: With a project open, click Tools > SDK Manager.

What is difference between Android NDK and sdk?

Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more. NDK is a complex and advanced topics.

Did not have a source properties file NDK?

Things to be checked if you are facing this error: If not, go to the NDK location inside your sdk folder,if there are multiple ndk versions delete previous versions if you don't need. Go inside the latest version folder and check whether source. properties file is present or not.


2 Answers

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.

like image 152
Carl Avatar answered Sep 17 '22 17:09

Carl


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.
like image 31
RagsB Avatar answered Sep 20 '22 17:09

RagsB