Search Unity

Question CommandInvokationFailure: Gradle build failed.

Discussion in 'AR' started by nursedayuksel, Oct 30, 2020.

  1. nursedayuksel

    nursedayuksel

    Joined:
    Oct 17, 2020
    Posts:
    18
    Good day everyone. I'm trying to connect ARCore in Unity, however whenever I try to build and run my program I keep getting an error at the gradle part and I couldn't find any solutions online to help me resolve my problem.

    The error I get:

    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    3.  
    4. stderr[
    5.  
    6. FAILURE: Build completed with 2 failures.
    7.  
    8. 1: Task failed with an exception.
    9. -----------
    10. * Where:
    11. Build file 'C:\Users\aliye\AR Core\Temp\gradleOut\launcher\build.gradle' line: 7
    12.  
    13. * What went wrong:
    14. A problem occurred evaluating project ':launcher'.
    15. > Could not find method classpath() for arguments [com.android.tools.build:gradle:5.1.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
    16.  
    17. * Try:
    18. 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.
    19. ==============================================================================
    20.  
    21. 2: Task failed with an exception.
    22. -----------
    23. * What went wrong:
    24. A problem occurred configuring project ':launcher'.
    25. > compileSdkVersion is not specified.
    26.  
    27. * Try:
    28. 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.
    29. ==============================================================================
    30.  
    31. * Get more help at https://help.gradle.org
    32.  
    33. BUILD FAILED in 1s
    34. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    35. ]
    36. stdout[
    37.  
    38. ]
    39. exit code: 1
    40. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    41. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    42. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    43. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    44. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    45. Rethrow as GradleInvokationException: Gradle build failed
    46. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    47. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    48. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    49. Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    50. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    51. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    52. 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 <4787bab5d6924cfaa63b02c00dafc983>:0)
    53. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    54. 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 <1fe7a3c0284a456b9681b7a93141c89a>:0)
    55. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    56.  

    my build.gradle:

    Code (CSharp):
    1. // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
    2.  
    3. apply plugin: 'com.android.application'
    4.  
    5. dependencies {
    6.     implementation project(':unityLibrary')
    7.     classpath 'com.android.tools.build:gradle:3.6.0'
    8.     }
    9.  
    10. android {
    11.     compileSdkVersion 29
    12.     buildToolsVersion '28.0.3'
    13.  
    14.     compileOptions {
    15.         sourceCompatibility JavaVersion.VERSION_1_8
    16.         targetCompatibility JavaVersion.VERSION_1_8
    17.     }
    18.  
    19.     defaultConfig {
    20.         minSdkVersion 24
    21.         targetSdkVersion 29
    22.         applicationId 'com.Nurseda.ARCore'
    23.         ndk {
    24.             abiFilters 'armeabi-v7a'
    25.         }
    26.         versionCode 1
    27.         versionName '0.1'
    28.     }
    29.  
    30.     aaptOptions {
    31.         noCompress = ['.unity3d', '.ress', '.resource', '.obb']
    32.         ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    33.     }
    34.  
    35.     lintOptions {
    36.         abortOnError false
    37.     }
    38.  
    39.     buildTypes {
    40.         debug {
    41.             minifyEnabled false
    42.             useProguard false
    43.             proguardFiles getDefaultProguardFile('proguard-android.txt')
    44.             signingConfig signingConfigs.debug
    45.             jniDebuggable true
    46.         }
    47.         release {
    48.             minifyEnabled false
    49.             useProguard false
    50.             proguardFiles getDefaultProguardFile('proguard-android.txt')
    51.             signingConfig signingConfigs.debug
    52.         }
    53.     }
    54.  
    55.     packagingOptions {
    56.         doNotStrip '*/armeabi-v7a/*.so'
    57.     }
    58.  
    59.     bundle {
    60.         language {
    61.             enableSplit = false
    62.         }
    63.         density {
    64.             enableSplit = false
    65.         }
    66.         abi {
    67.             enableSplit = true
    68.         }
    69.     }
    70. }
    71.  
    I'd really appreciate the help!
     
  2. Manhiem

    Manhiem

    Joined:
    Jul 31, 2019
    Posts:
    4
    Hey I have the same problem, did you findd any solution???
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    andyb-unity and satamaxx_unity like this.
  4. satamaxx_unity

    satamaxx_unity

    Joined:
    Mar 12, 2018
    Posts:
    1