Execution failed for task ':fluttertoast:compileDebugKotlin'

5,299

Updating the compileSdkVersion to 30 in my app/build.gradle solved it and allowed me to keep the latest gradle.

OLD ANSWER:

I'm not sure why, but I was able to resolve the problem by rolling back to

classpath 'com.android.tools.build:gradle:3.5.4'

in my top level build.gradle.

Share:
5,299
M.K. Malik
Author by

M.K. Malik

Updated on December 27, 2022

Comments

  • M.K. Malik
    M.K. Malik 10 months
    1. I tried flutter clean
    2. flutter pub cache repair,
    3. changing and versions of the fluttertoast package, and by removing it too,
    4. deleted the android/.gradle directory and rebuilt.

    Nothing worked.

    Launching lib\main.dart on Redmi Note 4 in debug mode...
    lib\main.dart:1
    Parameter format not correct -
    e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (45, 84): Unresolved reference: R
    e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (70, 68): Unresolved reference: R
    e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (85, 64): Unresolved reference: R
    2
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':fluttertoast:compileDebugKotlin'.
    > Compilation error. See log for more details
    
    * 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 39s
    Exception: Gradle task assembleDebug failed with exit code 1
    Exited (sigterm)