11
  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)
3
  • Could you provide your code of MethodCallHandlerImpl? Commented Feb 19, 2021 at 11:21
  • try previous version 7.1.6 Commented Feb 19, 2021 at 11:27
  • I am gettin the same error. I tried rolling back to 7.1.6, invalidating caches, flutter clean... none solved the problem. I know I installed an Android related update in Android Studio. Maybe it was related to that? Commented Feb 19, 2021 at 19:29

1 Answer 1

25

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.

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

5 Comments

Gradle what? Gradle file? Gradle folder? Gradle configuration? Gradle installation? Something else? Please respond by answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today).
Worked after flutter clean
Worked for me after rolling back the build:gradle version
classpath 'com.android.tools.build:gradle:3.5.4'
recently i ran "flutter upgrade" then i faced similar issue. i tried all suggestions posted here but nothing worked. then i ran "flutter downgrade", "flutter clean", "flutter pub get", and the app worked fine.. seems there is issue with flutter new version?!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.