flutter Gradle task Assemble Debug failed - flutter

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Exception: Gradle task assembleDebug failed with exit code 1
any help ??

in case someone has the same problem
the problem was with the directory of the project
It was in my main folder which has non English characters

Related

Unexpected lock protocol found in lock file. this error started when i run on android device. it is fine while run on chrome

FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':file_picker'.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Unexpected lock protocol found
in lock file. Expected 1, found 0.
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':file_picker' of type org.gradle.api.Project.
Could not find method implementation() for arguments [project ':flutter_plugin_android_lifecycle'] on
object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Could not get unknown property 'android' for project ':file_picker' of type org.gradle.api.Project.
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 11m 19s
Running Gradle task 'assembleDebug'... 693.6s
Exception: Gradle task assembleDebug failed with exit code 1
your pubspec.yaml package does not match with your gradle version
1. find which package[example: file_picker] does not match with your gradle.
2. go to the dependecies[lef side on vscode] -> direct
dependecy -> package[example: file_picker] -> example
-> android -> build.gradle [ example classpath 'com.android.tools.build:gradle:7.0.1' ]
3. follow step 2. -> and android -> gradle ->
wrapper [exapmle distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-all.zip]
4. please copy the distributed url from the step 3, and paste
into your project android-> gradle -> wrapper
5. also paste the example classpath
'com.android.tools.build:gradle:7.0.1' to your project andorid ->
build.gradle
this answer https://stackoverflow.com/a/67920804/17971818 helped me

Flutter Exception in thread "main" java.util.zip.ZipException: zip END header not found

I am facing such error after running flutter run command
Exception in thread "main" java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1497)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1504)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:191)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'... 390,5s
Exception: Gradle task assembleDebug failed with exit code 1
The error is related to Gradle, this is usually due to corrupt or incomplete Gradle setup
find (.gradle) folder and delete it
then run the application again and wait for new gradle setup to complete

gradle build error [Fatal Error] checker-qual-2.5.2.pom:2:1: Content is not allowed in prolog

[Fatal Error] checker-qual-2.5.2.pom:2:1: Content is not allowed in prolog.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve org.checkerframework:checker-qual:2.5.2.
Required by:
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre
Could not resolve org.checkerframework:checker-qual:2.5.2.
Could not parse POM https://jcenter.bintray.com/org/checkerframework/checker-qual/2.5.2/checker-qual-2.5.2.pom
Content is not allowed in prolog.
Could not resolve org.glassfish.jaxb:jaxb-runtime:2.2.11.
Required by:
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:sdklib:26.5.0 > com.android.tools:repository:26.5.0
Could not resolve org.glassfish.jaxb:jaxb-runtime:2.2.11.
Could not parse POM https://jcenter.bintray.com/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.pom
Could not resolve com.sun.xml.bind.mvn:jaxb-runtime-parent:2.2.11.
Could not resolve com.sun.xml.bind.mvn:jaxb-runtime-parent:2.2.11.
Could not parse POM https://jcenter.bintray.com/com/sun/xml/bind/mvn/jaxb-runtime-parent/2.2.11/jaxb-runtime-parent-2.2.11.pom
Could not resolve com.sun.xml.bind.mvn:jaxb-parent:2.2.11.
Could not resolve com.sun.xml.bind.mvn:jaxb-parent:2.2.11.
Could not parse POM https://jcenter.bintray.com/com/sun/xml/bind/mvn/jaxb-parent/2.2.11/jaxb-parent-2.2.11.pom
Resetting to invalid mark
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 44s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I had this same problem once. I found the problem was because of my firewall. I disabled the firewall for a while to run my app and it worked fine. After that, I added Android Studio to my firewall whitelist.
If the firewall is causing you the problem, disable the firewall and try to run it again. If it works, add Android Studio to the firewall whitelist.
Hope it helps :)
EDIT:
Since the above solution is not working, delete all the contents of the following directories after closing Android Studio:
C:\Users\username\.gradle\caches
C:\Users\username\.android\build-cache
C:\Users\username\.android\cache

sbt test task is failing in IDE

I am trying to run the test sbt task using my IDE but I am getting the following error:
Compiling 12 Scala sources to
/home/user/newPrs/projectname/processing/target/scala-2.11/test-classes...
[trace] Stack trace suppressed: run last test:copyResources for the full output.
[error] (test:copyResources) java.io.FileNotFoundException: /home/user/newPrs/projectname/processing/target/scala-2.11/test-classes/rawData/data.parquet (Permission denied)
Any idea how to fix this please?
Thanks a lot

Android duplicate dependencies error - Annotation

when I was building my projecti I get some errors like this
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/annotation/JacksonAnnotation.class
How can I resolve this problem?