1
Build file 'C:\Users\amani\Desktop\expenseapp\android\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to find target with hash string 'android-28' in: C:\Users\amani\AppData\Local\Android\Sdk

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

Launching lib\main.dart on ALE L21 in debug mode...

FAILURE: Build failed with an exception.

* Where:
* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

And android\build.gradle is as follows:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

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
}

Could anyone help me to solve this problem? I've tried many other solutions I found online but nothing seems to work and I can't figure out what to do to make this work.

Running the flutter doctor command returns this:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18363.592], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.41.1)
[√] Connected device (1 available)

• No issues found!
1
  • if you are using android studio, try using flutter clean command in terminal and then rebuild project Commented Jan 29, 2020 at 9:13

1 Answer 1

1

In your android/app/build.gradle file, change the compileSdkVersion from 28 to 29 and targetSdkVersion from 28 to 29.

Then, rebuild the project again.

Sign up to request clarification or add additional context in comments.

3 Comments

@AmaniSaaduddin open the android folder alone in android studio and try to build, there you will get the exact reason that will help you to resolve it.
Thanks for making time and answering, I updated my Android SDK and istalled JDK 8 and now it works fine.
@AmaniSaaduddin Feel free to accept my answer if you think it helped. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.