Error while trying to run a flutter project on both android studio and vscode

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

Project ran perfectly a 2 days ago but now this error is thrown each time i try to run. I have tried flutter clean & flutter pub cache repair. Output from flutter doctor:

[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 10.0.19044.1645], locale en-US)
    • Flutter version 2.8.0 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cf44000065 (5 months ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\123\AppData\Local\Android\Sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_SDK_ROOT = C:\Users\123\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java      
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)    
    • All Android licenses accepted.

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)   

[√] VS Code (version 1.67.1)
    • VS Code at C:\Users\123\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.40.0

[√] Connected device (1 available)
    • SM A530W (mobile) • 52008eb85aae152b • android-arm64 • Android 9 (API 28)

• No issues found!

Any ideas on what the issue might be will be appreciated

1 Like

This issue also occurs on my React Native app
I can build successful last week but yesterday I can’t build.

React Native: 0.59.9
Gradle version: 5.6.2
Command run: react-native run-android
Log:

FAILURE: Build failed with an exception.

* What went wrong:
Expected org.gradle.api.artifacts.result.ResolvedDependencyResult but found org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult

My workaround solution:
I ran command npx react-native run-android instead of react-native run-android then can build success. Hope it help in your case

I have this issue but with flutter app. I have a here_sdk plugin which is using gradle com.android.tools.build:gradle:7.1.0 but the gradle used in the build.gradle in the project is com.android.tools.build:gradle:3.5.0 .
I have tried many solutions including update the main project gradle to the latest one but with no result.
https://global.discourse-cdn.com/gradle/original/2X/4/4e1f480a0425ee966ccc23bf290cfbf60be1640a.png

https://global.discourse-cdn.com/gradle/original/2X/c/ccc59871abfe92ed8a345494cba00ffc55afc572.png

https://global.discourse-cdn.com/gradle/original/2X/2/2311bea998bb4a42417cbd1f662d819ee8765c88.png

I get the same error on my react-native project
react-native: 0.62.3
gradle: 6.0.1
@MwangiMartin @glorynguyen
How did you guys resolved your issue? It would help me a lot if you can share here