NDK at ~/Library/Android/sdk/ndk-bundle did not have a source.properties file

Viewed 84179

I have updated Android Studio to 4.1 in Macbook but not able to run app after updating. It is giving following error

Execution failed for task ':app:stripDebugDebugSymbols'.
NDK at ~/Library/Android/sdk/ndk-bundle did not have a source.properties file
35 Answers

After specifying ndk version in build.gradle file it is working

android {
        ndkVersion '21.3.6528147'
    }

And inside local.properties remove the following since it's deprecated and also conflicts with path:

ndk.dir=~/Library/Android/sdk/ndk-bundle

I had the same issue and solve it : Go to SDK location find NDK folder and check the folders if one of them is empty or corrupted delete it and let the android studio use the latest version you have.

For Android studio 4.1.1+ (gradle-plugin: 4.1.1 or above) use ndkVersion

No ndk.dir at local.properties. If there is, remove it

build.gradle (module)

android {
  defaultConfig {
     // ...
     ndkVersion = "21.1.6352462"
  }
}

Note: The specified version must exist at $SDK/ndk folder.

I had this error in Flutter.

my solution:

copy file C:\Users\username\AppData\Local\Android\Sdk\ndk\22.1.7171670\source.properties

to

C:\Users\username\AppData\Local\Android\Sdk\ndk-bundle

Ready!

File -> Project Structure -> SDK Location -> "Android NDK Location"
And click "Download" Android NDK. The problem will be solved after downloaded. enter image description here

For me, this issue occurred after I upgraded to Android Studio 4.1. To fix this, I had to explicitly pass the path of my NDK directory in my project's local.properties file. It can be done by adding this line in local.properties.

ndk.dir={Path to Android NDK directory}

In my case I don't have ndk dir in the local.properties file and also didn't add ndk version in the build.gradle. I just simply deleted the ndk-bundle folder in the android sdk folder. and it worked.

add ndkversionndk.dir=C:\Users\Hasif\AppData\Local\Android\Sdk\ndk\22.1.7171670

ndk.dir=C:\\Users\\Hasif\\AppData\\Local\\Android\\Sdk\\ndk\\22.1.7171670

enter image description here

This is random error from AS, which is encountered by few developers.

Most likely, you don't have NDK linked in your Android Studio.

I would suggest,

In your Android Studio, Go to File -> Project Structure -> SDK Location -> Under "Android NDK Location", click on "Download" Android NDK

Wait for download and re-build the project. Cheers.

  1. download NDK in setting, fix that issue.
  2. If you cant click Download. manually add this path to your local.properties file

ndk.dir=/Users/yourusername/Library/Android/sdk/ndk/21.3.6528147

21.3.6528147 --> version your NDK folder

enter image description here

Go to project structure then

Go to project structure then

Download the the NDK and rebuild the app.

This solution works for me. enter image description here

Android studio 4.1.1 can not set Android NDK Location on Project Structure, you need edit local.properties file and add

ndk.dir=/Users/yourname/Library/Android/sdk/ndk/21.3.6528147

on build.gradle file ndk version is:21.3.6528147

ext.versions = [
        'minSdk': 19,
        'targetSdk': 30,
        'compileSdk': 30,
        'kotlin': '1.4.10',
        'buildTools': '30.0.2',
        'ndk': '21.3.6528147'
    ]

I was also facing the same problem from a few weeks and I had tried my best but didn't work. Then I downloaded NDK using android studio.

Screenshot of Android Studio

After downloading the NDK also not resolved my problem. Then I visited the SDK folder and found NDK and NDK-bundle. As I know the two folders have the same properties.

I had copied the source.properties file from the NDK \ 23.1.7779620 and pasted it into the NDK-Bundle folder.

Screenshot of source.properties file

It is working perfectly.

You should also try...

Make sure you have downloaded and installed NDK bundle under Sdk directory. If not open SDK Manager. Install it by checking NDK(Side by side)

Go to Settings -> Appearance & Behavior -> System settings -> Android SDK

Restart the IDE and try it again. If further any problem, pls add this code in build.gradle file

android {
    ........

    defaultConfig {
        .........

        ndkVersion '22.1.7171670' // Your downloaded NDK version
    }
}

Note: Keep your local.properties file like bellow:

sdk.dir=C:\\Users\\User\\AppData\\Local\\Android\\sdk # My installed SDK location
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
ndk.dir=c\:\\Users\\DanielWaiguru\\AppData\\Local\\Android\\Sdk\\ndk\\22.1.7171670

has been deprecated and the AGP should set the default ndk version but in case it doesn't, specify a specific version of ndk in your build.gradle as follows

android {
    ndkVersion <version> 
}

for example

ndkVersion "22.1.7171670"

Things to be checked if you are facing this error:

  • Check whether Ndk location is specified or not in local.properties file.

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. Copy the folder path and specify the path in the local.properties file.

For me it is

ndk.dir=C:\Users\admin\AppData\Local\Android\Sdk\ndk\22.0.6917172

  • In app level build.gradle file specify the version number if it is incorrect

For me it is

android {

ndkVersion '22.0.6917172'

}

Important note:

The value for ndk.dir should no longer be set in your app's local.properties file, and support for this ndk.dir setting will be removed in a future version. The Android Gradle Plugin sets the NDK version by default, but if you need a specific version of the NDK, you can set android.ndkVersion in build.gradle.

You can visit this official page for more details

I was facing the same issue and solved it Go to the Sdk path and then go inside the ndk folder and then cut - paste the folder with the version name somewhere else and then clean and rebuild.

I am using Android Studio 4.1.1 on MacOS 11.1. None of the above solutions worked for me. What worked for me was not a reconfiguration of gradle files but a simple reconfiguration of the NDK package.

cd ~/Library/Android/sdk/ndk/22.0.7026061
cp android-ndk-r22/source.properties .

The root cause for this is: for a specific buildToolsVersion, might come with a default ndk version, but this version of ndk might not located under the ndk.dir, so a simple fix would be

android {
    ndkVersion <an existing version of ndk>
}
> Task :app:stripDebugDebugSymbols FAILED react native

> NDK at C:\Users\{username}\AppData\Local\Android\Sdk\ndk\21.4.7075529 did not have a source.properties file

if you are using the react native change ndk version in build.gradle

i was changed ndkVersion = "21.4.7075529" to ndkVersion = "22.1.7171670"

Go to build.gradle file paste ndkVersion "23.1.7779620" in the android section

android { compileSdkVersion 30 ndkVersion "23.1.7779620" }

Me too! When I upgrade AS4.0.1---->4.1.1

And project‘s build.gradle

classpath 'com.android.tools.build:gradle:4.1.1'

gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

I got this problem,And solution is very simple:

I copy the file to ndk-bundle directory

DONE

Try downgrading your gradle version to 3.4.2, by adding the following line to your Project's build.grade file,

classpath 'com.android.tools.build:gradle:3.4.2'

1.First of all make sure you have installed ndk on the android studio sdk manager 2. add the following lines in the local.properties file

ndk.dir = C:\\Users\\MACOWIGO\\AppData\\Local\\Android\\Sdk\\ndk\\22.1.7171670

  1. then on the build.gradle file add the following line

    buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 21 compileSdkVersion = 29 targetSdkVersion = 29 ndkVersion = "22.1.7171670" }

nake sure the ndk version provided on the build.gradle file is the same as the one provided/written in local.properties file

Removing following line from local.properties worked for me as mentioned in accepted answer it is deprecated.

ndk.dir=~/Library/Android/sdk/ndk-bundle

For Flutter projects:

Run the command flutter clean in your android studio terminal.

Then add the ndk version in the defaultConfig in the file at this location: android > app > build.gradle, just like shown below:

android{
  defaultConfig {
    ndkVersion = "22.1.7171670"
  }
}

First of all do you really use NDk?

1.If yes you can try above accepted answer and let android studio download latest ndk for you

2.If no then go to NDK folder location /Users/yourname/Library/Android/sdk/ndk/ Delete all folder that start with "ndk" like ndk , ndk-bundle . Rebuild project

In my case running several Flutter builds, it seems I had an older NDK version installed that I no longer needed. Removing that via SDK Manager fixed the issue

> NDK at /Users/gene/tools/android-sdk-macosx/ndk/21.1.6352462 did not have a source.properties file

Trying the answers here to update the SDK, I removed the offending NDK version, with plan to refresh the update. However, after then trying to run the app without bringing back that older NDK, all apps then built successfully

Just remove or rename ndk-bundel in Android SDK folder

Just go to:

  1. File settings
  2. Search for the Android SDK
  3. In the SDK tools, locate ndk and tick "show package details."
  4. Download the ndk error version displaying on your console.
  5. Make sure you've cmake sdk also installed

In my case upgrade gradle as follows at gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

My case is funny.

I downloaded ndkVersion '24.0.8215888' one minute before, and use it.

Then OK.

Here is in

/Users/xx/Library/Android/sdk/ndk/

111

And in app/build.gradle


android {
    ndkVersion '24.0.8215888'
}

And in gradle/local.properties

ndk.dir=/Users/xx/Library/Android/sdk/ndk/24.0.8215888

I tried NDK 21.1.6352462 a lot,

Not working.

I am not sure about other cases but in my case, i facing the same issue

NDK at D:\Android\sdk\ndk-bundle did not have a source.properties file

And by deleting ndk-bundle folder and then rebuilding the project solved my issue Hope anyone else gets this helpful

Related