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

AndroidAndroid StudioAndroid Ndkbuild.gradle

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

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.

Solution 3 - Android

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.

Solution 4 - Android

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

Solution 5 - Android

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!

Solution 6 - Android

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}

Solution 7 - Android

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.

Solution 8 - Android

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.

Solution 9 - Android

  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

Solution 10 - Android

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

Solution 11 - Android

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

Solution 12 - Android

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'
    ]

Solution 13 - Android

> 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

Solution 14 - Android

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"

Solution 15 - Android

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...

Solution 16 - Android

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

Solution 17 - Android

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.

Solution 18 - Android

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 .

Solution 19 - Android

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>
}

Solution 20 - Android

> 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"

Solution 21 - Android

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

android { compileSdkVersion 30 ndkVersion "23.1.7779620" }

Solution 22 - Android

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

Solution 23 - Android

Downloan Ndk https://developer.android.com/ndk/downloads And place in /Users/yourname/Library/Android/sdk/ndk/21.3.6528147

Solution 24 - Android

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'

Solution 25 - Android

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

Solution 26 - Android

  1. Go to local.properties(SDK Locations)

  2. Add to NDK Source path

    ndk.dir=c\:\\Users\\SankA\\AppData\\Local\\Android\\Sdk\\ndk\\22.1.7171670

Look Like this Image - Myexample image

Solution 27 - Android

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

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

Solution 28 - Android

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"
  }
}

Solution 29 - Android

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

Solution 30 - Android

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

Solution 31 - Android

Just remove or rename ndk-bundel in Android SDK folder

Solution 32 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKrishna MeenaView Question on Stackoverflow
Solution 1 - AndroidKrishna MeenaView Answer on Stackoverflow
Solution 2 - Androidmmdreza baqalpourView Answer on Stackoverflow
Solution 3 - AndroidMahdi-MalvView Answer on Stackoverflow
Solution 4 - AndroidLai LeeView Answer on Stackoverflow
Solution 5 - AndroidTavoView Answer on Stackoverflow
Solution 6 - AndroidAbdul MateenView Answer on Stackoverflow
Solution 7 - AndroidMr. ZeroOneView Answer on Stackoverflow
Solution 8 - AndroidmpalsView Answer on Stackoverflow
Solution 9 - AndroidIndra As LesmanaView Answer on Stackoverflow
Solution 10 - AndroidSachidanand PanditView Answer on Stackoverflow
Solution 11 - AndroidlavaView Answer on Stackoverflow
Solution 12 - AndroidoHuflyingView Answer on Stackoverflow
Solution 13 - AndroidSubarata TalukderView Answer on Stackoverflow
Solution 14 - AndroidDaniel WaiguruView Answer on Stackoverflow
Solution 15 - AndroidBibek Kumar SahView Answer on Stackoverflow
Solution 16 - AndroidDharaneshvarView Answer on Stackoverflow
Solution 17 - AndroidPranay DasView Answer on Stackoverflow
Solution 18 - AndroidDark MatterView Answer on Stackoverflow
Solution 19 - AndroidkyokoseView Answer on Stackoverflow
Solution 20 - AndroidNagaraj ksView Answer on Stackoverflow
Solution 21 - AndroidWasif MehmoodView Answer on Stackoverflow
Solution 22 - AndroidAlexChuView Answer on Stackoverflow
Solution 23 - AndroidCrimissView Answer on Stackoverflow
Solution 24 - AndroidAshwin BalaniView Answer on Stackoverflow
Solution 25 - AndroidJoseph OwigoView Answer on Stackoverflow
Solution 26 - AndroidSanka GeethanjanaView Answer on Stackoverflow
Solution 27 - AndroidWaqas AhmedView Answer on Stackoverflow
Solution 28 - AndroidPratham SinghView Answer on Stackoverflow
Solution 29 - AndroidAkashi SinghView Answer on Stackoverflow
Solution 30 - AndroidGene BoView Answer on Stackoverflow
Solution 31 - AndroidDebdutta PandaView Answer on Stackoverflow
Solution 32 - AndroidKwesi WelbredView Answer on Stackoverflow