0

I startet my Flutter project via Android Studio for a while and i had no problem to code and to run this project from e AVD oder a physiical Device (via USB). One week ago, i had a problem because of JAVA_HOME. I could solved this problem but its still not possible to run this problem. Bow i have this message when i try to run my project:

Launching lib\main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • 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 1s Finished with error: Gradle task assembleDebug failed with exit code 1

What can i do?

Enea
  • 35
  • 3
  • https://stackoverflow.com/questions/35000729/android-studio-could-not-initialize-class-org-codehaus-groovy-runtime-invokerhel is that helpful? – ajay Oct 27 '20 at 08:14

1 Answers1

0

1- project fence

2- select Android / gradle / wrapper / gradle-wrapper.properties

3- change the distributionUrl line to https \: //services.gradle.org/distributions/gradle-6.3-all.zip

That solves your problem?

Reference image

They asked the same thing here

https://stackoverflow.com/questions/35000729/android-studio-could-not-initialize-class-org-codehaus-groovy-runtime-invokerhel
anDres
  • 101
  • 1
  • 5
  • Thank you for your answer. i could do this with success. It's still not possible to run my project. When I click to "run", i receive this message: – Enea Oct 30 '20 at 13:52
  • Launching lib\main.dart on sdk gphone x86 arm in debug mode... Running Gradle task 'assembleDebug'... FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\USERNAME\Documents\Android Studio\utile_dulci\android\app\build.gradle' line: 41 – Enea Oct 30 '20 at 13:53
  • * What went wrong: Could not compile build file 'C:\Users\USERNAME\Documents\Android Studio\utile_dulci\android\app\build.gradle'. > startup failed: build file 'C:\Users\USERNAME\Documents\Android Studio\utile_dulci\android\app\build.gradle': 41: unexpected token: utile_dulci @ line 41, column 23. applicationId utile_dulci ^ – Enea Oct 30 '20 at 13:53
  • 1 error * 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 998ms Finished with error: Gradle task assembleDebug failed with exit code 1 – Enea Oct 30 '20 at 13:54
  • You you know what I could do now? – Enea Oct 30 '20 at 13:54
  • It has the complete error message, in the last flutter update the version 6.5 is used and neither the 6.3 gradle 'com.android.tools.build:gradle:4.0.1' – anDres Nov 09 '20 at 17:22