Flutter run error. exiting with code 1 Could not resolve all artifacts for configuration ':classpath'

79
May 05, 2022, at 5:30 PM

I am trying to run my first flutter app in visual studio code, but when I run flutter run -v, execution end it with error. See it below:

[ +131 ms] executing: uname -m
[  +78 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +20 ms] executing: [/home/luis/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +19 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c
[   +1 ms] executing: [/home/luis/snap/flutter/common/flutter/] git tag --points-at
5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c
[  +30 ms] Exit code 0 from: git tag --points-at 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c
[        ] 2.10.0
[  +23 ms] executing: [/home/luis/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +10 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/luis/snap/flutter/common/flutter/] git ls-remote --get-url origin
[  +11 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +234 ms] executing: [/home/luis/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[  +19 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[ +184 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +10 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +193 ms] executing: /home/luis/Android/Sdk/platform-tools/adb devices -l
[  +88 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm
           transport_id:1
[  +21 ms] /home/luis/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +101 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +308 ms] Skipping pub get: version match.
[ +182 ms] Generating /home/luis/Flutter
applications/mmp/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +178 ms] ro.hardware = ranchu
[  +25 ms] Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling
software
           rendering with "--enable-software-rendering".
[  +91 ms] Initializing file store
[  +29 ms] Skipping target: gen_localizations
[  +24 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
updated contents: /home/luis/Flutter applications/mmp/.dart_tool/package_config_subset}
[  +89 ms] gen_dart_plugin_registrant: Complete
[   +2 ms] _composite: Starting due to {}
[   +1 ms] _composite: Complete
[  +12 ms] complete
[  +20 ms] Launching lib/main.dart on sdk gphone x86 in debug mode...
[  +14 ms] /home/luis/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/luis/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/luis/snap/flutter/common/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental
--target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true
--output-dill /tmp/flutter_tools.FBFHLX/flutter_tool.UPXJHV/app.dill --packages /home/luis/Flutter
applications/mmp/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
[  +48 ms] executing: /home/luis/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +40 ms] <- compile package:mmp/main.dart
[ +117 ms] --------- beginning of main
                    02-07 09:46:33.153 E/wifi_forwarder( 2132): RemoteConnection failed to initialize:
                    RemoteConnection failed to open pipe
[  +45 ms] executing: /home/luis/Android/Sdk/platform-tools/adb version
[  +77 ms] Android Debug Bridge version 1.0.41
           Version 31.0.0-7110759
           Installed as /home/luis/Android/Sdk/platform-tools/adb
[   +4 ms] executing: /home/luis/Android/Sdk/platform-tools/adb start-server
[  +31 ms] Building APK
[  +48 ms] Running Gradle task 'assembleDebug'...
[  +99 ms] Using gradle from /home/luis/Flutter applications/mmp/android/gradlew.
[ +232 ms] executing: [/home/luis/Flutter applications/mmp/android/] /home/luis/Flutter
applications/mmp/android/gradlew -Pverbose=true -Ptarget-platform=android-x86 -Ptarget=/home/luis/Flutter
applications/mmp/lib/main.dart -Pbase-application-name=android.app.Application
-Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true
-Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+3488 ms] FAILURE: Build failed with an exception.
[  +23 ms] * What went wrong:
[        ] A problem occurred configuring root project 'android'.
[        ] > Could not resolve all artifacts for configuration ':classpath'.
[   +7 ms]    > Could not find databinding-common-4.1.0.jar (androidx.databinding:databinding-common:4.1.0).
[        ]      Searched in the following locations:
[        ] 
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/4.1.0/databinding-common-4.1.0.jar
[  +26 ms]    > Could not find baseLibrary-4.1.0.jar (com.android.databinding:baseLibrary:4.1.0).
[        ]      Searched in the following locations:
[        ] 
https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/4.1.0/baseLibrary-4.1.0.jar
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log
output. Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 3s
[ +808 ms] Running Gradle task 'assembleDebug'... (completed in 4.7s)
[+19139 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +2 ms] "flutter run" took 25,742ms.
[  +21 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1161:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand
(package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
           
           
[ +263 ms] ensureAnalyticsSent: 252ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

Attemting to fix it, I manually downloaded databinding-common-4.1.0.jar, baseLibrary-4.1.0.jar, calculated sha1 value, and put them in the correct direction respectively.

.gradle/caches/modules-2/files-2.1/androidx.databinding/databinding-common/4.1.0

Even after that the error persist. File build.gradle:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
allprojects {
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

File gradle-wrapper.properties:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

I could not find the solution on the internet. What can I do?

Rent Charter Buses Company
READ ALSO
Remove a variable of a class from another part of the code

Remove a variable of a class from another part of the code

I have a class that I pass as a parameter to a functionThis class contains various companion objects

125
Detect selected file type in onActivityResult

Detect selected file type in onActivityResult

I'trying to open camera with video and photoThis code working correctly but in onActivityResult can't check file type

110
How do ensure the flutter app is working on all android devices out there?

How do ensure the flutter app is working on all android devices out there?

We have a flutter app on iOS and android and we test on 2 or 3 android devices before every release and it works fine without any issueBut when I see in the review, people are giving 1 star says that the app is not working for them

97
Missing programFiles/java when trying to publish rn app

Missing programFiles/java when trying to publish rn app

okay, when i wanna publish my reactNative app and see the docs i'm stuck on the first step

97