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

37

98

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

and don't forget to mention latest ndk version if you seleted android{

 ndkVersion: '25.1.8937393'

}

Heptode answered 15/10, 2020 at 13:14 Comment(1)
just remove ndk folder and try ( User/Android/Sdk/Ndk )Colville
H
103

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
Heptode answered 15/10, 2020 at 13:28 Comment(11)
Happened to me as well, but this solution didn't work for me.Heirdom
On Android Studio 4.1Heirdom
Please check your NDK version which you have installed.Heptode
The ndk.dir in the local.properties will work fine for the Gradle Plugin version < 4.1.0 and the Gradle version < 6.5. But, Gradle will complain once you start to use the latest versions. developer.android.com/studio/releases/gradle-pluginLondrina
I had to put full path to ndk including version: "ndk.dir=[...]\\Android\\Sdk\\ndk\\21.3.6528147"Gradate
I see the NDK dirs (22.0.7026061 and 21.1.6352462) have source.properties. None of the remedies in this answer worked for me. I am using Android Studio 4.1.1 on Mac OS 11.1.Punchinello
I have tried it and it worked. But when I upload the apk to play store it shows a warning ... "This App Bundle contains native code, and you've not uploaded debug symbols. We recommend you upload a symbol file to make your crashes and ANRs easier to analyze and debug". How does this affect my app & how to solve it?Lucinalucinda
@KrishnaMeena this worked for me, but when i upload apk to google play console it shows like this - i.imgur.com/BOQzU3Q.png. How to solve this.Lucinalucinda
@Lucinalucinda Follow this #62569257Heptode
updating build.gradle fix my issueFollowthrough
It worked for me. I was using NDK version (23.1.7779620).Dungaree
R
74

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.

Ruthenious answered 19/10, 2020 at 13:38 Comment(5)
That was the working one. By doing this IDE is auto selecting the last one. It was looking into an empty folder so ofc it couldn't find any source.properties file. Thx !Liberty
This usually occurs when you cancel the build while it's installing a NDK, you're left with a corrupt/empty folder.Dallman
Yes this worked for me, the ndk-bundle directory was empty so I removed it and voila, everything worked!Ultrasonics
Thanks, for me I had the following structure: sdk -> ndk -> 21.1.6352462 -> .installer and sdk -> ndk -> 21.1.6352462 -> 24.0.8215888 -> build, ... So I used corrupted 21.1.6352462, change to 24.0.8215888 worked for meLimbert
This should be voted as the correct answerMap
G
42

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!

Geronto answered 24/5, 2021 at 17:26 Comment(4)
There is ndk-bundle folder. However your answer helped as I copied the source.properties from 22.1.7171670 to the folder next to it 21.1.6352462 since it was mentioned in the error. Then everything workedUnifoliolate
This is really a strange solution, but I will like to register my thank you - it works perfectly for me!Superphysical
This too worked to me, I copied the source.properties to their parent folder, and the build was successful.Narrative
Thanks, this is much better than the accepted answer.Mingmingche
P
36

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

Perrotta answered 2/12, 2020 at 13:37 Comment(4)
somehow it can't click download. must manually add on local.properties.Corelli
I downloaded it for a first time. Right away I checked the path was not there and the "download" link was now disabled. But the NDK was indeed installed here (Windows): C:\Users\myuser\AppData\Local\Android\Sdk\ndk\22.0.7026061. I just needed to add this path in the file named local.properties (which is in the root of your android project, i.e: path_to_your_project/android/), backslashes escaped, just as the path for sdk.dirHatchet
What if that donload button doesnt show upCacogenics
I downloaded ndk version that GitHub repo needs and the problem was solved. thank you.Ecumenicist
H
28

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.

Hype answered 25/11, 2020 at 23:56 Comment(1)
This also works for Flutter. This is the build.gradle inside App. So the directory structure is android/app/build.gradleRolo
H
12

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}
Heirdom answered 16/10, 2020 at 22:28 Comment(0)
H
12

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.

Halfpint answered 18/8, 2021 at 10:41 Comment(0)
R
7

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

Rile answered 30/6, 2021 at 16:15 Comment(0)
U
7

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

Unconventionality answered 22/11, 2021 at 16:12 Comment(2)
"You should also try ..." Try what ? Can you add the missing part ? :)Precede
@Precede Try what he mentioned above. Copy source.properties from ndk to ndk-bundle. This worked for me. Thanks, man!Subset
S
7

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

Showthrough answered 2/9, 2022 at 17:13 Comment(2)
Solved for me as well.Countrydance
solved for me, Thanks @Zahid IqbalBouchard
G
6

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.

Grania answered 19/10, 2020 at 9:30 Comment(3)
after download ndk you need to add ndk location link to local.properties file like this: ndk.dir=/Users/apple/Library/Android/sdk/ndk-bundleDrying
Brillant! Had this problem after updating to Android Studio 4.1 + Gradle to 6.5. Once you clicked the download button and downloaded the NDK, don't forget to click the "Apply button" to update properly your project. Then click OK.Quiteris
In my case, right after installed the NDK (23.1.7779620), I had to add this line ndk.dir=/home/myuser/Android/Sdk/ndk/23.1.7779620 to my local.propertiesKbp
C
6
  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

Corelli answered 10/1, 2021 at 23:29 Comment(0)
T
5

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

Thereat answered 10/6, 2021 at 12:20 Comment(0)
P
4

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'
    ]
Postman answered 22/11, 2020 at 8:56 Comment(0)
O
4

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
Obituary answered 6/4, 2021 at 19:7 Comment(1)
This worked for me in Linux / Ubuntu with React Native ClientBaro
S
4

Just remove or rename ndk-bundel in Android SDK folder

Sententious answered 9/4, 2022 at 19:11 Comment(0)
G
3
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"
Gae answered 25/5, 2021 at 14:53 Comment(0)
B
3

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
Belcher answered 30/5, 2022 at 14:30 Comment(0)
B
2

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

Beefburger answered 20/11, 2020 at 18:47 Comment(0)
N
1

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.

Nata answered 5/12, 2020 at 11:40 Comment(1)
This worked for me using React-Native-CliEsker
P
1

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 .
Punchinello answered 30/12, 2020 at 4:39 Comment(0)
I
1

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>
}
Incurve answered 22/9, 2021 at 10:54 Comment(1)
you helped me a lot. I accidentally downloaded half NDK and that was causing problem. just go to /Users/username/Library/Android/sdk and delete NDK bundle folder . ;)Repossess
D
1
> 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"

Depersonalize answered 3/11, 2021 at 10:29 Comment(0)
W
1

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

android { compileSdkVersion 30 ndkVersion "23.1.7779620" }

Willem answered 19/11, 2021 at 5:46 Comment(2)
Welcome to SO! I don't really see how this answer adds anything to the many existing answers. Please only post additional answers if you have contents that add value somehow.Koosis
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Rella
F
0

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

Faye answered 14/12, 2020 at 11:4 Comment(1)
which file you copied exactly please?Yuriyuria
V
0

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

Ventricular answered 1/3, 2021 at 8:35 Comment(1)
This is the best solution so far! Before installing what you downloaded remove each directory in ndk folder.Anarchic
J
0

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'

Jerrold answered 12/5, 2021 at 13:16 Comment(0)
B
0

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

Born answered 13/5, 2021 at 16:33 Comment(0)
H
0
  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

Hellen answered 19/5, 2021 at 17:26 Comment(0)
C
0

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

ndk.dir=~/Library/Android/sdk/ndk-bundle
Clave answered 28/5, 2021 at 6:54 Comment(0)
N
0

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"
  }
}
Numbers answered 7/6, 2021 at 6:42 Comment(0)
C
0

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

Castellany answered 18/6, 2021 at 10:54 Comment(3)
Because the OP accepted the answer, doesn't that mean that only option1 in your answer is trueLubalubba
Android studio let you download the latest ndk and that is vry much correct answer and i have tried that too.But my point is if you application uses NDK then only update the NDK otherwise just remove the NDK folders as mentioned in 2nd point. Just randomly downloading latest ndk does not make sense if you really don't use it.Castellany
Downvoting because removing the NDK should not be a recommended solution as it might affect those projects which require the usage of NDK.Heirdom
T
0

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

Tmesis answered 17/10, 2021 at 20:5 Comment(0)
V
0

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

distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Valaree answered 16/6, 2022 at 10:47 Comment(0)
F
0

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.

Faucher answered 26/6, 2022 at 16:53 Comment(0)
M
0

The error suggest that the ndk version installed has missed source.properties file, SO change ndkVersion on build.gradle onto correctly installed ndk version with that file OR if missing re-install ndk.

Minyan answered 15/3 at 11:42 Comment(0)
Z
0

For me the problem was that a previous attempt to automatically download and install a certain NDK version during a build failed due to insufficient disk space. That left the $ANDROID_HOME/ndk folder in an inconsistent state (it had an almost empty folder 25.1.8937393).

Solution:

cd $ANDROID_HOME/ndk
rm -rf 25.1.8937393

Check the contents of the folder beforehand and adjust the version according to the error message.

Zenaidazenana answered 10/5 at 19:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.