cannot compile unity project - unity3d

CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_192\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.10.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':lintVitalRelease'.
Could not resolve all files for configuration ':lintClassPath'.
Could not find org.codehaus.groovy:groovy-all:2.4.12.
Searched in the following locations:
file:/C:/d/programs/android sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
file:/C:/d/programs/android sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
file:/C:/d/programs/android sdk/extras/google/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
file:/C:/d/programs/android sdk/extras/google/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
… and more...

Related

CommandInvokationFailure: Gradle build failed

I am new to unity. I am using unity 2021.3.10f1 I made my own game and added advertising and other features. When trying to build, it shows the error "CommandInvokationFailure: Gradle build failed." Can you help? An error that is shown in unity:
CommandInvokationFailure: Gradle build failed.
D:\HappyWin\Unity and projects\2021.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "D:\HappyWin\gradle-6.1.1\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':launcher:lintVitalRelease'.
> This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.fragment:fragment:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.versionedparcelable:versionedparcelable:1.1.0, androidx.core:core:1.2.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.viewpager:viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core:core-common:2.0.0, androidx.annotation:annotation:1.2.0, androidx.startup:startup-runtime:1.0.0, androidx.tracing:tracing:1.0.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0
Changed gradle to different versions. Did not help.

How to solve this Gradle build error that happens after cloning a project and starting VS Code?

I just cloned a project and I got this error. My collegue who cloned the same project does not have this error. I can start the project, but this error still bothers me. Does anyone have an idea how to solve this error?
[info] [gradle-server] Server started, listening on 49745
[info] Gradle client connected to server
[info] Java Home: C:\Program Files\Java\jdk-17.0.5
[info] JVM Args: --add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant
[info] Gradle User Home: C:\Users\User\.gradle
[info] Gradle Version: 7.3
[error] FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\User\projects\billing-ui\build.gradle' line: 15
* What went wrong:
An exception occurred applying plugin request [id: 'nebula.ospackage', version: '3.4.0']
> Failed to apply plugin class 'com.netflix.gradle.plugins.packaging.SystemPackagingBasePlugin'.
> Could not create an instance of type com.netflix.gradle.plugins.packaging.ProjectPackagingExtension.
> Could not find matching constructor for: org.gradle.api.internal.file.copy.DefaultCopySpec(org.gradle.api.internal.file.BaseDirFileResolver, org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator)
* 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
CONFIGURE FAILED in 9s
[error] [gradle-server] The supplied build action failed with an exception.
[error] Error getting build for c:\Users\User\projects\billing-ui: The supplied build action failed with an exception.
[info] Java Home: C:\Program Files\Java\jdk-17.0.5
[info] JVM Args: --add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant
[info] Gradle User Home: C:\Users\User\.gradle
[info] Gradle Version: 7.3
[error] FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\User\projects\billing-ui\build.gradle' line: 15
* What went wrong:
An exception occurred applying plugin request [id: 'nebula.ospackage', version: '3.4.0']
> Failed to apply plugin class 'com.netflix.gradle.plugins.packaging.SystemPackagingBasePlugin'.
> Could not create an instance of type com.netflix.gradle.plugins.packaging.ProjectPackagingExtension.
> Could not find matching constructor for: org.gradle.api.internal.file.copy.DefaultCopySpec(org.gradle.api.internal.file.BaseDirFileResolver, org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator)
* 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
CONFIGURE FAILED in 1s
[error] [gradle-server] The supplied build action failed with an exception.
[error] Error getting build for c:\Users\User\projects\billing-ui: The supplied build action failed with an exception.
[info] Found 0 tasks
I get this error after cloning the project and opening VS Code.

A problem occurred in the build.gradle file

FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\it\StudioProjects\untitled\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
com/google/common/util/concurrent/internal/InternalFutureFailureAccess

Error in flutter project build gradle problem

What went wrong:
A problem occurred configuring root project 'android'
Could not resolve all artifacts for configuration
":classpath
Could not find com.android.tools.build:gradle:6.7.
Searched in the following locations:
-nttps:1/dl.google.com/d/android/maven2/com/android/tools/build/aradle/6.7/gradle-6.7.pom
nttps://repo_naven_apache.org/maven2/com/android/tools/build/aradle/6.7/gradle-6.7.pom
Required by:
project

Package Build gradle failed

everytime i add google_maps_flutter package i always get this error but in another project it's fine.
Please help...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.1.2\android\build.gradle'
* What went wrong:
Could not compile build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.1.2\android\build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61