4

I am using Android Studio 3.6.1 and Gradle 6.3-all. I tried to sync my project and got the following error:

Expected org.gradle.api.artifacts.result.ResolvedDependencyResult but found org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult

No idea how to fix this.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
udarts
  • 745
  • 1
  • 8
  • 23
  • File>invalidate caches/restart – MMG Apr 06 '20 at 18:09
  • @MohammadMoeinGolchin thanks replying, already tried that multiple times, without luck. Keep getting the same error. – udarts Apr 07 '20 at 07:48
  • See my answer for this question and change your dependencies, then sync. https://stackoverflow.com/questions/61025926/android-studio-cant-find-kotlin-dependency/61025960#61025960 – MMG Apr 07 '20 at 07:51
  • Do I need to update the dependencies individually as well? – udarts Apr 07 '20 at 08:33
  • Update it, it should work – MMG Apr 07 '20 at 08:37
  • I updated all dependencies and did: File>invalidate caches/restart, but still the error occurs. – udarts Apr 07 '20 at 08:43
  • Don't update dependencies, copy and paste my dependencies to see it works or not – MMG Apr 07 '20 at 08:45
  • I copied and pasted your dependencies, and resycned, but no change – udarts Apr 07 '20 at 09:07
  • Again previous error? – MMG Apr 07 '20 at 10:02
  • Yes, it's still the same. – udarts Apr 07 '20 at 10:41
  • Have you cleaned and rebuilded the project?! – MMG Apr 07 '20 at 11:49
  • If I try to run: Clean Project, it gives me the same error: Expected org.gradle.api.artifacts.result.ResolvedDependencyResult but found org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult – udarts Apr 07 '20 at 12:22
  • https://stackoverflow.com/questions/20812703/cant-find-org-gradle-api-artifacts-result-resolvedmoduleversionresult-when-appl – MMG Apr 07 '20 at 12:24
  • Why would I downgrade to 1.9? That is really old. I also tried downgrading to an slightly older version (4.3), but the same error still shows. – udarts Apr 07 '20 at 12:26
  • Try View > Tool Windows > Gradle – MMG Apr 09 '20 at 01:39
  • I also added it to the gradle github: https://github.com/gradle/gradle/issues/12723 and it seems more people have the same issue. So I wonder if this a general issue. – udarts Apr 09 '20 at 19:41
  • @MohammadMoeinGolchin tried that, but nothing shown there – udarts Apr 10 '20 at 10:55

4 Answers4

3

Ok, Some how I got working, by running the following command: watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache, also removed the .gradle & .idea folders and some .iml files and reopend the project.

udarts
  • 745
  • 1
  • 8
  • 23
1

Go to Android Studio 3.6.2, 3.6.1 version has bug

MMG
  • 3,226
  • 5
  • 16
  • 43
  • Thanks for the reply, already tried updating, but the error remains, also tried resetting the whole thing, it's frustrating. – udarts Apr 11 '20 at 07:31
  • 2
    Ok, Some how I got working, by running the following command: watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache, also removed the .gradle & .idea folders and some .iml files and reopend the project. – udarts Apr 11 '20 at 13:31
  • 1
    I suspect that there is a gradle cache inside node_modules, removing the directory fixes the issue. – Vicary Apr 25 '20 at 08:39
  • 1
    clearing out node_modules did the trick! You're a life saver @udarts – Udi May 30 '20 at 01:17
0

I had the same issue while creating APK. The following steps help me to resolve the issue.

  1. Change the Gradle version to 6.1.1.
  2. Delete node module and npm install.
  3. npm cache verify.
0

I have same issue on flutter and resolved by upgrade gralde version

build.gradle

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

gradle-warpper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
Mahmoud Abu Alheja
  • 3,343
  • 2
  • 24
  • 41