Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter app: A problem occurred configuring root project 'android' [duplicate]

I have install windows 10 64 bit and Android studio 64 bit. Making android apps work great. Everything is OK.

I have install Flutter SDK. This is result of "flutter doctor -v" :

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (6 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at F:\andevelop\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = F:\andevelop\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted. 

[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
• SM A305F • R58M40JXVGM • android-arm64 • Android 10 (API 29)

• No issues found!

But I cannot solve this problem. I have tried every solution found on internet. Please help me. Thanks a lot.

Launching lib\main.dart on SM A305F in debug mode... Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

    Could not resolve all artifacts for configuration ':classpath'. Could not find gradle.jar (com.android.tools.build:gradle:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar Could not find builder.jar (com.android.tools.build:builder:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.0/builder-3.5.0.jar Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.0/crash-26.5.0.jar Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.0/lint-gradle-api-26.5.0.jar Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.0/gradle-api-3.5.0.jar Could not find databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.5.0/databinding-compiler-common-3.5.0.jar Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.5.0/manifest-merger-26.5.0.jar Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.5.0/sdk-common-26.5.0.jar Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.5.0/builder-test-api-3.5.0.jar Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.5.0/ddmlib-26.5.0.jar Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.5.0/tracker-26.5.0.jar Could not find sdklib.jar (com.android.tools:sdklib:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.5.0/sdklib-26.5.0.jar Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.5.0/layoutlib-api-26.5.0.jar Could not find dvlib.jar (com.android.tools:dvlib:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.5.0/dvlib-26.5.0.jar Could not find repository.jar (com.android.tools:repository:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.5.0/repository-26.5.0.jar Could not find shared.jar (com.android.tools.analytics-library:shared:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.5.0/shared-26.5.0.jar Could not find common.jar (com.android.tools:common:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/common/26.5.0/common-26.5.0.jar Could not find jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-beta04/jetifier-processor-1.0.0-beta04.jar Could not find bundletool.jar (com.android.tools.build:bundletool:0.9.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.9.0/bundletool-0.9.0.jar Could not find jetifier-core.jar (com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta04/jetifier-core-1.0.0-beta04.jar Could not find protos.jar (com.android.tools.analytics-library:protos:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.5.0/protos-26.5.0.jar Could not find builder-model.jar (com.android.tools.build:builder-model:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.5.0/builder-model-3.5.0.jar Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.5.0/apkzlib-3.5.0.jar Could not find apksig.jar (com.android.tools.build:apksig:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.5.0/apksig-3.5.0.jar Could not find annotations.jar (com.android.tools:annotations:26.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.5.0/annotations-26.5.0.jar Could not find databinding-common.jar (androidx.databinding:databinding-common:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.5.0/databinding-common-3.5.0.jar Could not find baseLibrary.jar (com.android.databinding:baseLibrary:3.5.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.5.0/baseLibrary-3.5.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 Finished with error: Gradle task assembleDebug failed with exit code 1

And this is the app build.gradle code:

buildscript {
ext.kotlin_version = '1.3.50'
repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

allprojects {
repositories {
    google()
    jcenter()
 }
}

 rootProject.buildDir = '../build'
 subprojects {
 project.buildDir = "${rootProject.buildDir}/${project.name}"
 }
 subprojects {
 project.evaluationDependsOn(':app')
 }

 task clean(type: Delete) {
  delete rootProject.buildDir
 }
like image 954
Hossein Seifi Avatar asked Nov 16 '25 22:11

Hossein Seifi


2 Answers

Really this had me for like two hours, I upgraded flutter, I ran pub get, pug upgrade, updated all android plugins, I don't know if this had something to do but also updated the android sdk version from sdk manager, the one similar to my phone which was android 10, went to the android folder and added this to the build.gradle : maven() and also nothing, I ended up removing it. After all the upgrades I decided to restart my computer and magically everything was working again, restarting ide did nothing

like image 165
Alberto Pereda Rojas Avatar answered Nov 18 '25 12:11

Alberto Pereda Rojas


Solved this problem by renaming the current project 'project_save' recreating a new Flutter project called the same name as the former one and then copied all the asset files, src code, android manifest, key, icon, script and pubspec.yaml to the new one. Took 15mn against a whole day yesterday trying to figure out the issue...

like image 39
Antonin GAVREL Avatar answered Nov 18 '25 13:11

Antonin GAVREL