Search Unity

Bug Can't build for Android because of gradle build errors unresolveable by noobs like me

Discussion in 'Android' started by cashman91431, Nov 20, 2022.

  1. cashman91431

    cashman91431

    Joined:
    Aug 21, 2022
    Posts:
    16
    There are 5 separate errors. I have no idea what to search for so I went here:

    1.
    > 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
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\30.0.2\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-30\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only

    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

    2.
    FAILURE: Build failed with an exception.

    * What went wrong:
    Could not determine the dependencies of task ':launcher: processDebugResources'.
    > Could not resolve all task dependencies for configuration ':launcher:debugRuntimeClasspath'.
    > Did not resolve 'android.arch.core:runtime:1.1.1' which is part of the dependency lock state
    > Did not resolve 'android.arch.core:common:1.1.1' which is part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:viewmodel:1.1.1' which is part of the dependency lock state
    > Resolved 'androidx.lifecycle:lifecycle-process:2.0.0' which is not part of the dependency lock state
    > Did not resolve 'com.android.support:support-core-utils:26.1.0' which is part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:livedata-core:1.1.1' which is part of the dependency lock state
    > Did not resolve 'com.android.support:support-annotations:26.1.0' which is part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:extensions:1.1.1' which is part of the dependency lock state
    > Did not resolve 'com.android.support:support-core-ui:26.1.0' which is part of the dependency lock state
    > Did not resolve 'com.android.support:support-fragment:26.1.0' which is part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:common:1.1.1' which is part of the dependency lock state
    > Resolved 'androidx.lifecycle:lifecycle-extensions:2.0.0' which is not part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:runtime:1.1.1' which is part of the dependency lock state
    > Did not resolve 'android.arch.lifecycle:livedata:1.1.1' which is part of the dependency lock state
    > Resolved 'androidx.lifecycle:lifecycle-service:2.0.0' which is not part of the dependency lock state
    > Did not resolve 'com.android.support:support-compat:26.1.0' which is part of the dependency lock state

    * 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 1s
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

    3.
    * 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 1s
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[

    > 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
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\30.0.2\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-30\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <cef18509d2a64c60b8ff238a98d49698>: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 <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <cef18509d2a64c60b8ff238a98d49698>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, 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 <1135c66e5f4c41a7831fa5798849d8b6>:0)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

    4.
    Build completed with a result of 'Failed' in 16 seconds (16093 ms)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

    5.
    UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <1135c66e5f4c41a7831fa5798849d8b6>:0
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <1135c66e5f4c41a7831fa5798849d8b6>:0
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

    I have no idea whats causing them. I tried folowing this: https://forum.unity.com/threads/gradle-build-failed.1000522/ did not help.
    btw unity editor version is: 2021.3.1f1
    Thanks for looking at it
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    1. Try toggling the Android Sdk and Gradle checkmarks in Unity preferences
    2. Run unity with admin access
     
  3. cashman91431

    cashman91431

    Joined:
    Aug 21, 2022
    Posts:
    16
    I will try that, just to say I already built 1 build and worked fine. Now even without changing any settings it said something about AndroidX preferences not enabled, so I tried something and it worked. Kinda. Here we are now
     
  4. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Which Unity version are you using and were you able to test your Apk build and it worked fine?
     
  5. cashman91431

    cashman91431

    Joined:
    Aug 21, 2022
    Posts:
    16
    Unity version 2021.3.1f1 and yes I was able to do 1 build successfully without the unity calling me a failure and saying something about AndroidX dependencies. Then I fixed that and here we are now
     
  6. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Mehn mine is crashing at startup on Samsung galaxy S7 edge with the implementation of IAP, UnityAds and play games services I am extremely tired
     
  7. cashman91431

    cashman91431

    Joined:
    Aug 21, 2022
    Posts:
    16
    I have unity ads also
     
  8. ashaker20

    ashaker20

    Joined:
    Feb 16, 2022
    Posts:
    3
    did you fix this?
     
  9. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Not yet I left the project for now will be going back to it soon
     
  10. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Share the crash log.
     
  11. javierron90

    javierron90

    Joined:
    Feb 1, 2020
    Posts:
    3
    Were you able to fix this?
     
  12. cashman91431

    cashman91431

    Joined:
    Aug 21, 2022
    Posts:
    16
    I made a new project
     
    javierron90 likes this.