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?
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
Related
I have installed android studio properly, gave it all it needed for flutter development, java jdk version is 11, paths are properly given, the emulator runs fine but when i try to build my app on either emulator or a physical device, I get this error:
Launching lib\main.dart on V2109 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'D:\untitled1\android\app\build.gradle' line: 26
What went wrong:
A problem occurred evaluating project ':app'.
java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\ADMIN.gradle\caches\jars-9\53ad1f30a5eec66e4e9dc584d5b89b7f\fastutil-7.2.0.jar.
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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Here is my flutter doctor response
Please help. Your help will be appreciated
I was expecting the project to run properly, as with the same flutter doctor response and same installation procedures on 2 different laptops I was able to run properly. I have tried reinstalling android studio thrice but of no help. tried everything I could related to java (installed different versions, updating paths).
I use android studio and flutter. two days ago I updated them and after that, I cannot build apk files, even the demo program that is increment counting with floating action button. I do not know how to fix it. Here is the error:
C:\src\flutter\bin\flutter.bat --no-color build apk
Building with sound null safety
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
What went wrong:
org/fusesource/jansi/Ansi
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
Running Gradle task 'assembleRelease'... 1,695ms
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
I even uninstalled android studio and reinstalled it but it did not work. Can anybody help me with this problem?
I just finished setting flutter up in VS Code, I created an android emulator and it runs fine, but when i try to launch the demo app of flutter i get this error:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Parameter format not correct -
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\Java\jre1.8.0_291' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
* 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 4s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
What's the problem?
Install Android Studio, it is a must if you are new, you can always use VSCODE for development but Android studio needs to be there.
Best way is uninstall vscode, install android studio, install flutter and dart plugin in android studio, then install vscode, it will work.
Also try running
flutter doctor
What does it say?
I have a problem with my Flutter app.
When I tried to start my app via an emulator, I got the following error message:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\AdoptOpenJDK\jre-11.0.11.9-hotspot' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
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
Exception: Gradle task assembleDebug failed with exit code 1
.
this is the standrad app which is created by flutter when creating a project and I have not changed it. When I received the message for the first time, I reinstalled gradle and java. but it didn't work. Can you help me?
Can anyone tell me what's wrong with Android Studio. I cannot run flutter projects. It returns the error showed in the picture.
Android Studio version: 3.6.3
Flutter version: 1.22.1 with Dart 2.10.1
The Error showed while executing main.dart:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 41
What went wrong:
A problem occurred evaluating script.
FlutterPlugin
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 23s
Exception: Gradle task assembleDebug failed with exit code 1
Error message from main.dart
I have faced this error before and the solution that works for me is to clean the build folder by using
flutter clean
and uninstall the app from emulator/connect to any other device
Found the solution:
I had to delete the cache file from .gradle folder and run project. And it worked.
Directory of the cache file: C:\user(username)\ .gradle
I changed the virtual device's x86 image to x86_64 and the problem was solved. Still don't understand the underlying cause, but it worked.