2

I am trying to run my flutter app but I got some error.

 FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:mergeDebugResources'.
    > Specified AAPT2 executable does not exist: C:\Users\john\.gradle\caches\transforms-2\files-2.1\a406eb4ba72ff395bc6c8b1db90b3b1f\aapt2-3.5.0-5435860-windows\aapt2.exe. 
    Must supply one of aapt2 from maven or custom location.
        
    * 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

This is my buildscript

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

Last time I can run my flutter app but now I don't know what happened. I hope you can help me. TIA

CodeFloat
  • 57
  • 9

3 Answers3

1

I just found the solution to my problem.

I changed the dependencies classpath in my buildsript

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

Into

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

Now it's working!

CodeFloat
  • 57
  • 9
0

click in file and Invalidate caches

enter image description here

if not solved verify you resources and delete document mipmap-anydpi-v26

enter image description here

where click in Build and clean project

enter image description here

0

Try running flutter clean on Android Studio's terminal or just selecting the option on the Flutter menu at the top:

Flutter clean tools

If this doesn't work, take a look at this question: How to solve Specified AAPT2 executable does not exist on Android Studio 3.2

Michel Feinstein
  • 13,416
  • 16
  • 91
  • 173