AppLovin / AppLovin-MAX-Unity-Plugin

129 stars 35 forks source link

Build Gradle Errors #329

Open bedirhanblt54 opened 10 months ago

bedirhanblt54 commented 10 months ago

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.

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.

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

AntonPetrov83 commented 10 months ago

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

bedirhanblt54 commented 10 months ago

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

hussainraodev commented 10 months ago

i am also facing the same issue, any solution?

bedirhanblt54 commented 10 months ago

@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 commented 10 months ago

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

Moizkhan999 commented 10 months ago

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 commented 10 months ago

@Moizkhan999 Thanks brother, i will try this out.

zeonagames commented 9 months ago

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

github-actions[bot] commented 2 weeks ago

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