0
votes

I made a simple text-based Android app on Unity. When I tried to build it to make app bundle, the errors below occurred. If there is anyone who is familiar with these errors, would you give me some advice to address the issue?

Error 1

Exception: Gradle install not valid UnityEditor.Android.GradleWrapper.GetBaseCommand (System.Int32 jvmHeapSize) (at <13e769c2760a442eaf6dff80696716f1>:0)

UnityEditor.Android.PostProcessAndroidPlayer.ExecuteWarmup (System.String stagingArea) (at <13e769c2760a442eaf6dff80696716f1>: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 <13e769c2760a442eaf6dff80696716f1>:0)

UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <13e769c2760a442eaf6dff80696716f1>: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/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Error2

Build completed with a result of 'Failed' UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Error3

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

"Details of the errors"

The errors always occur, when Unity is dealing with these 3 parts below during app build.

1, Hidden/VideoDecode - Flip_NV12_To_RGB1: Stripping Vertex programs

2, Hidden/Compositing -Mix_RGBA_To_RGBA: Stripping vertex programs

3, Hidden/VideoDecodeAndroid - RGBASplitExternal_To_RGBA: Stripping Vertex...

"About Unity platform"

My Unity version: 2019.2.9f1 and 2019.2.13f1(I updated after I came across the errors)

Android SDK(28.0.3),NDK(android-ndk-r16b) and openJDK(1.8.0_152) that I use are ones that are originally installed in the Unity version.

The item of "Gradle install with Unity(recomemded)" has already been checked.

I chose the LWRP template, when I built the project first.

2
This is about c#, not unityscript. - Ruzihm

2 Answers

1
votes

I had a similar issue.
For me this answer from https://answers.unity.com/questions/1534863/gradle-install-not-valid.html worked:

if you go to editor>Preferences External Tools tab there is a check box for Gradle Install with Unity. Make sure this check box is checked

0
votes

Check your gradle path. It should be folder containing lib/gradle-launcher-*.jar

For my case it was just changing gradle path in UnityEditor settings from /usr/local/Cellar/gradle/6.7.1 to /usr/local/Cellar/gradle/6.7.1/libexec

UnityEditor errors should be more verbose about such misconfiguration.

// UnityEditor.Android.GradleWrapper
internal static string GetBaseCommand(int jvmHeapSize)
{
    string gradleLaunchJarPath = AndroidGradleRoot.GetGradleLaunchJarPath(AndroidGradleRoot.GetInstance().GetRootDirectory());
    bool flag = string.IsNullOrEmpty(gradleLaunchJarPath);
    if (flag)
    {
        throw new Exception("Gradle install not valid");
    }
    return string.Format("-classpath \"{0}\" org.gradle.launcher.GradleMain \"-Dorg.gradle.jvmargs=-Xmx{1}m\"", gradleLaunchJarPath, jvmHeapSize);
}

// UnityEditor.Android.AndroidGradleRoot
internal static string GetGradleLaunchJarPath(string directory)
{
    string path = Paths.Combine(new string[]
    {
        directory,
        "lib"
    });
    string[] array = AndroidFileLocator.Find(Path.Combine(path, "gradle-launcher-*.jar"));
    bool flag = array.Length == 1;
    string result;
    if (flag)
    {
        result = array[0];
    }
    else
    {
        result = null;
    }
    return result;
}