NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN error

93,356

Solution 1

I had similar problem and solved it by opening project using Import project (Gradle, Eclipse, etc.) instead of Open existing Android Studio project.

Solution 2

You can download NDK from File>Project Structur>Choosing SDK location from left panel and pressing Download from NDK location part.

Solution 3

I was having the same issue after upgrading my android studio. You just need to open local.properties & change ndk.dir path to your NDK path.

Code:

ndk.dir=D\:\\Android\\SDK\\ndk-bundle
sdk.dir=D\:\\Android\\SDK

Solution 4

I don't use NDK in my project, but I had the same problem. The problem disappeared after I updated the SDK version to the newest compileSdkVersion 29

Solution 5

I had a previous answer (since deleted by moderators) where I detailed that there are workarounds (as listed here) that work for some but that there is an underlying bug in gradle because the workarounds don't work for everyone (specifically: none of them work for me)

The related google issue is here: https://issuetracker.google.com/issues/140403764

Update: As of today (20190920) they indicate that they have fixed the underlying issue, so I would expect a future release of gradle after today (20190920) will contain the fix.

Update2: Today (20190926) I received a response from a googler that the problematic code was in Android Studio and it is contained on the 3.6-release branch but is not available on any publicly available build at the moment (Android Studio 3.6 Canary 12 was released just before this fix was made). That lets you know which component to update and which versions to pay attention to, anyway. Looks like Android Studio 3.6 Canary 13 and later should have it https://issuetracker.google.com/issues/140403764#comment13

Until then you can try the workarounds but when there's a vendor bug and workarounds don't work you just have to wait for a vendor patch.

Share:
93,356

Related videos on Youtube

Farhad Farzin
Author by

Farhad Farzin

Android Developer

Updated on April 26, 2020

Comments

  • Farhad Farzin
    Farhad Farzin about 4 years

    After updating Android Studio and Gradle to 3.5, I now get this error:

    NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN

    I changed the Gradle version in build-gradle back to 3.4.2 but it didn't help.

    • Dan Albert
      Dan Albert over 4 years
      What version is your NDK? How was it installed? How are you using it in your project (specified in build.gradle, local.properties, or ANDROID_NDK_HOME)? What's in the source.properties file in the NDK?
    • Farhad Farzin
      Farhad Farzin over 4 years
      Thank you for your attention my problem is solved .... just i migrated to AndroidX
    • Adam
      Adam over 4 years
      I have same problem after upgrade. But my project using AndroidX andRefactor mograte dosen't work & help. Second problem. My app normally fit in singe DEX. Release is 27500 methods. After upgrade Android Studio and Kotlin + google services. App need 73000 methods ;/
    • The incredible Jan
      The incredible Jan over 4 years
      Where did you get this "error"? I get this message after Android Studio update in all of my projects in the Event Log but it has no impact. Everything builds and runs as it should. I never used NDK - so I don't care if it would not work.
    • Farhad Farzin
      Farhad Farzin over 4 years
      i think ... the "NDK version" is not main problem.... i import project again... and the problem resolved
    • Script47
      Script47 over 4 years
    • Mike Hardy
      Mike Hardy over 4 years
      It's possible none of the solutions work for you (they did not work for me). The issue is being tracked by google, you can star it there issuetracker.google.com/issues/140403764
  • Reenactor Rob
    Reenactor Rob over 4 years
    The answer might be made more valuable by stating how you knew where to find the file in android studio or on the file system and your reasoning in determining that was the change to make.
  • Farhad Farzin
    Farhad Farzin over 4 years
    i coding with JAVA and i haven't NDK at all
  • The incredible Jan
    The incredible Jan over 4 years
    ndk.dir is not set in my projects. I never used NDK. Nevertheless I get this "error" in Android Studio 3.5.
  • The incredible Jan
    The incredible Jan over 4 years
    Doesn't make any sense if you don't use it.
  • Mike Hardy
    Mike Hardy over 4 years
    That did not solve it for me. I still have the error even with gradle 5.6.1 / plugin 3.5.0 / Android Studio 3.5.0 after importing the project again
  • Mike Hardy
    Mike Hardy over 4 years
    The question is about the error message and an answer shouldn't require installing it to get rid of the message. The NDK is an optional package
  • Mike Hardy
    Mike Hardy over 4 years
    This makes no sense if you do not have and do not want the NDK. It is an optional component
  • Mike Hardy
    Mike Hardy over 4 years
    Same as The Incredible Jan, this was not in my local.properties yet I still get this message. So it is not a complete solution but perhaps it could help some
  • Zahra
    Zahra over 4 years
    The answer is for anyone who uses NDK and faces this error and in the question is not mentioned that he uses NDK or not .@The
  • Mike Hardy
    Mike Hardy over 4 years
    Interesting - I thought that had potential so I tried it, it still did not solve it for me. There is an open issue here issuetracker.google.com/issues/140403764
  • Vlad
    Vlad over 4 years
    @MikeHardy currently I'm using Gradle plugin version 3.5.0 and gradle version 5.4.1. Try to change this versions, while bug will be fix. Hope it's help you.
  • Mike Hardy
    Mike Hardy over 4 years
    For completeness (since I said it did not work for me) this actually does work for me - and is required even - to fix a separate silly sort of gradle + react-native native module compile issue. So as a "Android Studio / gradle" trick to have in your bag of tricks, it's a good one.
  • KingKongCoder
    KingKongCoder over 4 years
    go to File>Project Structure>DownloadNDK which will download and add path to your local properties which might fix things up if this answer didn't work
  • Serdar Samancıoğlu
    Serdar Samancıoğlu over 4 years
    That did not work for me, instead I had to download ndk, despite not using it.
  • Sahan Pasindu Nirmal
    Sahan Pasindu Nirmal over 4 years
    This is not worked for me. Either below any answer not worked for me. Please help
  • Sahan Pasindu Nirmal
    Sahan Pasindu Nirmal over 4 years
    everything is up-to-date but it still the same!
  • Hocine Djouamaa
    Hocine Djouamaa over 4 years
    go to 'file > project structre > SDK location ' and download the last NDK and go to project 'local.properties' and specific the NDK location like this 'ndk.dir=C\:\\Users\\Lenovo\\AppData\\Local\\Android\\Ndk'
  • Sahan Pasindu Nirmal
    Sahan Pasindu Nirmal over 4 years
    It is doesn't make any sense if you don't use it (NDK)
  • Sean
    Sean over 4 years
    I am using AS 3.5.1, my project need NDK. Got the exact error, clean and rebuild fixed it. Easier enough to try it first before doing anything else.
  • Ryan
    Ryan over 4 years
    @Sean Nice, glad it worked! By the way, I think the rebuild also starts out with a clean. I realized that once when I had the lower build toolbar open and it had 'clean' as the first task. Ever since then I just started hitting the rebuild only. (Hopefully it's doing what I think it is lol).
  • Yu Kakizaki
    Yu Kakizaki over 4 years
    i missed that you wrote "Gradle 3.5" and "build-gradle back to 3.4.2".
  • Pablo Alfonso
    Pablo Alfonso over 4 years
    NDK takes almost 1GB of your previous hard drive! And I'm not sure if there is some other impact (like memory, performance, CPU, etc.). Why do we need to download it if it is never used ? Can we just ignore the error ?
  • Zahra
    Zahra over 4 years
    @Pablo Yes , if you don't use NDK and non of answers helped , ignore the error .
  • Dmitriy Pavlukhin
    Dmitriy Pavlukhin over 4 years
    I closed project, deleted all Build folders, .iml files, .idea folder. Then opened project and it built successfully
  • Ziad H.
    Ziad H. over 4 years
    upgrading target and compile version to sdk 29 worked for me :D
  • Kyle Abens
    Kyle Abens over 4 years
    This worked for me but only on the first time. If I reopened the project without first deleting .gradle then I would get the same error as before.
  • Fox
    Fox over 4 years
    Yes, it seems the error will stay in the log. Mine has it as well on-going but project builds and runs just fine.
  • norlesh
    norlesh over 4 years
    After trying at least 5 different 'solutions' this one finally got me back on track, now to move on to whatever the next Android Studio bug happens to be...
  • Brian Hong
    Brian Hong over 4 years
    @DmitriyPavlukhin Thanks a lot! your comment worked! in my case, it happened after I merged two repositories.
  • bitlather
    bitlather over 4 years
    @KingKongCoder I found that link at File > Project Structure > SDK Location > Download Android NDK
  • leoneboaventura
    leoneboaventura about 4 years
    local.properties says "This file is automatically generated by Android Studio. Do not modify this file -- YOUR CHANGES WILL BE ERASED!"
  • BlackHatSamurai
    BlackHatSamurai about 4 years
    I also had to upgrade my Gradle version