Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Gradle Errors #329

Open
bedirhanblt54 opened this issue Jan 11, 2024 · 9 comments
Open

Build Gradle Errors #329

bedirhanblt54 opened this issue Jan 11, 2024 · 9 comments
Labels
bug Something isn't working stale This isue has been inactive

Comments

@bedirhanblt54
Copy link

bedirhanblt54 commented Jan 11, 2024

MAX Plugin Version

6.1.2

Unity Version

2020.3.34f1

Device/Platform Info

Android

Current Behavior

I integrated the AppLovin MAX SDK into my Unity project, and there were no issues; I could build successfully. Later, I downloaded the Google AdMob and Unity Ads adapters, and since then, I've been encountering Gradle errors during the build process. Unfortunately, I haven't been able to resolve this issue for a long time.

"I wrote my first issue, and it seems a bit complicated. I apologize for any confusion."

Expected Behavior

No response

How to Reproduce

"Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)"`

`"Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':launcher:lintVitalRelease'.

Could not resolve all artifacts for configuration ':launcher:debugRuntimeClasspath'.
Failed to transform androidx.fragment.fragment-1.7.0-alpha07-.aar (:androidx.fragment.fragment-1.7.0-alpha07:) to match attributes {artifactType=android-manifest, org.gradle.status=integration}.
> Execution failed for JetifyTransform: /Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.fragment.fragment-1.7.0-alpha07.aar.
> Failed to transform '/Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.fragment.fragment-1.7.0-alpha07.aar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
Failed to transform androidx.work.work-runtime-2.9.0-.aar (:androidx.work.work-runtime-2.9.0:) to match attributes {artifactType=android-manifest, org.gradle.status=integration}.
> Execution failed for JetifyTransform: /Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.work.work-runtime-2.9.0.aar.
> Failed to transform '/Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.work.work-runtime-2.9.0.aar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).

  • 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

BU??LD FAILED in 12s

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)"`

`"CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2020.3.34f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2020.3.34f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':launcher:lintVitalRelease'.

Could not resolve all artifacts for configuration ':launcher:debugRuntimeClasspath'.
Failed to transform androidx.fragment.fragment-1.7.0-alpha07-.aar (:androidx.fragment.fragment-1.7.0-alpha07:) to match attributes {artifactType=android-manifest, org.gradle.status=integration}.
> Execution failed for JetifyTransform: /Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.fragment.fragment-1.7.0-alpha07.aar.
> Failed to transform '/Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.fragment.fragment-1.7.0-alpha07.aar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
Failed to transform androidx.work.work-runtime-2.9.0-.aar (:androidx.work.work-runtime-2.9.0:) to match attributes {artifactType=android-manifest, org.gradle.status=integration}.
> Execution failed for JetifyTransform: /Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.work.work-runtime-2.9.0.aar.
> Failed to transform '/Users/bedirhanbulut/Desktop/Unity/Game/FishingGame/Temp/gradleOut/unityLibrary/libs/androidx.work.work-runtime-2.9.0.aar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).

  • 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

BU??LD FAILED in 12s
]
stdout[
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <6a716de7adab400ca518968c37af7005>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <6a716de7adab400ca518968c37af7005>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <6a716de7adab400ca518968c37af7005>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at <6a716de7adab400ca518968c37af7005>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <6a716de7adab400ca518968c37af7005>:0) Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <6a716de7adab400ca518968c37af7005>:0) UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

Additional Info

No response

@bedirhanblt54 bedirhanblt54 added the bug Something isn't working label Jan 11, 2024
@AntonPetrov83
Copy link

@bedirhanblt54 Is it reproducible in an empty project with just the AppLovin SDK and forementioned adapters?

@bedirhanblt54
Copy link
Author

@AntonPetrov83 I tried, but the result is the same.

@hussainraodev
Copy link

i am also facing the same issue, any solution?

@bedirhanblt54
Copy link
Author

bedirhanblt54 commented Jan 12, 2024

@hussainraodev

For me, it worked like this:

Firstly, I upgraded Unity to version 2022.3.17f1, and then I configured my Build Settings > Player Settings > Publishing Settings as shown in the image_1.
Next, I entered the baseProjectTemplate folder and found that the Android Gradle Plug-in version was 7.1.2 (image_2). I needed to use Gradle version 7.2 for this Plug-in version (I obtained this information from "https://docs.unity3d.com/Manual/android-gradle-overview.html"). I downloaded Gradle 7.2 from "https://gradle.org/releases/" (choose the "binary-only" option and extract it from the ZIP file). I used this in my Unity project as follows: Settings > External Tools (usage is shown in image_3). After that, I disable the Custom Base Gradle Template option, and finally, I performed Assets > ExternalDependencyManager > Android Resolver > Resolve or Force Resolve. The issue was resolved, and now I could build

I forgot to mention, set the Target API level to 33.

image_1 image2 image3

@hussainraodev
Copy link

@bedirhanblt54 Thanks brother, issue solved by upgrading unity version to 2022.

@Moizkhan999
Copy link

if you are using unity 2020 you need atleast gradle 6.7 or above and add its corresponding classpath in baseprojecttemplate.gradle file . For Example I used gradle 6.9.3 and added the following path classpath 'com.android.tools.build:gradle:4.2.1'.
Hope this resolves happy coding.

@hussainraodev
Copy link

@Moizkhan999 Thanks brother, i will try this out.

@zeonagames
Copy link

zeonagames commented Feb 26, 2024

It supports android 14 api level 34 while we choose api level 33 ?

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale This isue has been inactive label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale This isue has been inactive
Projects
None yet
Development

No branches or pull requests

5 participants