38

When I am trying to run my flutter app on a device my build fails to give this error

Execution failed for task ':app:stripDebugDebugSymbols'.  
NDK at C:\Users\User\AppData\Local\Android\sdk\ndk-bundle did not have a source.properties file

I have ndk version 23.0.7421159rc5 installed. Here's the result of flutter doctor

[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[!] Android Studio (version 4.0)
    X Unable to find bundled Java version.
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.57.1)
[√] Connected device (3 available)

Please help to resolve the issue

2
  • Thanks for posting the github link. I found the workaround there. Commented Nov 24, 2021 at 15:50
  • some times it is solving by removing ndk from local.properties. Commented Mar 29, 2022 at 15:55

9 Answers 9

74

Go inside your SDK location and find the directory called ndk then delete the content inside that directory. Then build the app again. Probably the ndk version has corrupted and Android Studio will replace it with the latest.

Sign up to request clarification or add additional context in comments.

1 Comment

This solution is for Unable to find bundled Java version error in your terminal. Its from August 9, 2021 Check the link for the solution stackoverflow.com/a/68703869/8555332
16

You can resolve this issue by the following steps,

  1. In build.gradle file add ndkVersion

    android {
         ...
         ndkVersion '21.1.6528147'
    }
    
  2. In local.properties remove ndk.dir

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

If still issue occurs then you have to remove the ndk folder from your machine.

  1. Take you run command window (Win + R) and type %USERPROFILE%\AppData\Local\Android\SDK. Or you can type the same in the file explorer address bar, then open the ndk folder from there. If you installed ndk in a different directory, then open that folder.

  2. Delete all contents of that directory.

  3. Restart the IDE.

enter image description here

Comments

5

1.In your Android studio project change ndk version 2.Go to android>app>build.gradle

3.Add ndkVersion "add your ndk version number" ndk version

Comments

3

1. From your PC set Show hidden files.

2. Go to C:\Users\NameOfPC\AppData\Local\Android\Sdk\ndk

3. Delete all the files inside the folder named 21.1.6352462 it depends on what number you are getting error, it might be 22 or 23 etc. (This is the Version of android) 21 is for Lollipop.

4. Download and choose file from here - Choose what version you are getting error. Example android-ndk-r21e-windows-x86_64.zip

5. Extract the file inside folder named 21.1.6352462

6 And run the IDE again.

Image Refence below

Show hidden folder

Show hidden folder 2

Path folder

Website image

Comments

3

I deleted Ndk and Ndk-bundle folder in /Library/Android/sdk

So, the problem fixed.

Probably the ndk version has corrupted

When I deleted that folder, Android Studio replaced it with the latest.

  • Go inside your SDK location
  • Find the directory called ndk
  • Then delete the content inside that directory.
  • Then build the app again.

Comments

1

For anyone who might get here. This can also be one of the problem situations. First, check here :

path-to-sdk/sdk/ndk

If there is a version of NDK with all files inside, it means that your NDK is not recognized correctly. Outside of this folder, check the ndk-bundle folder. If this folder exists and a folder named .installer is in there. Remove it and try running your project again.

make sure you added ndk.dir in your local.properties file :

sdk.dir= path-to-sdk\\sdk
ndk.dir= path-to-sdk\\sdk\\ndk

Comments

0

Root Cause

This happens when you have at least one version of ndk installed. It might be because of some other project you would have installed it.

The issue happens because the AGP (Android Gradle plugin) used by flutter projects might be above 3.6+.

Android Gradle plugin 3.6+ uses a default ndk version if no version is specified in projects app/build.gradle file.

See the official docs here. https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp

Solution

So inorder to fix the above issue. The best solution is to install the default ndk version used by AGP (See the link above) using sdk manager in android studio.

For example:

  1. If your AGP version in build.gradle is 4.1.0 then based on above docs link download and install NDK version 21.1.6352462 from sdk manager.

Comments

0

[Select Project structure in menu and in sdk location add NDK Path its reolve the issue ][1]

1 Comment

This looks wrong, why would you add NDK path in sdk location.
0

I noticed my app wasn't building and was getting the same error as above.

The error was because the app was looking for ndk 21.1.6528147 on my local machine but couldn't find it.

I checked my system to know the versions available via /Users/<your_user>/Library/Android/sdk and realised I have version 22.1.7171670 so I went to my build.gradle file and added ndkVersion '22.1.7171670'

android {
     ...
     ndkVersion '21.1.6528147'
}

I synced and tried to build my app again and all was fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.