flutter app: A problem occurred configuring root project 'android'

Viewed 6711

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.

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
 }
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

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...

Related