CommandInvokationFailure: Gradle build failed.

Here is the error

CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_112\bin\java.exe -classpath “E:\Program\Unity 5.6.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar” org.gradle.launcher.GradleMain “assembleRelease”

stderr[
C:\New folder\PlatformVR2\Temp\gradleOut\build\intermediates\manifests\full\release\AndroidManifest.xml:17:24-40: AAPT: No resource found that matches the given name (at ‘label’ with value ’ @anon_76954444 /app_name’).

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:processReleaseResources’.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\New folder\sdk-tools-windows-3859397\build-tools\26.0.0\aapt.exe’’ finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    ]
    stdout[
    Incremental java compilation is an incubating feature.
    :preBuild UP-TO-DATE
    :preReleaseBuild UP-TO-DATE
    :checkReleaseManifest
    :preDebugBuild UP-TO-DATE
    :prepareOVRPluginLibrary UP-TO-DATE
    :prepareReleaseDependencies
    :compileReleaseAidl UP-TO-DATE
    :compileReleaseRenderscript UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :mergeReleaseShaders UP-TO-DATE
    :compileReleaseShaders UP-TO-DATE
    :generateReleaseAssets UP-TO-DATE
    :mergeReleaseAssets
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources UP-TO-DATE
    :mergeReleaseResources UP-TO-DATE
    :processReleaseManifest UP-TO-DATE
    :processReleaseResources FAILED

BUILD FAILED

Total time: 13.054 secs
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()

here is my AndroidManifest

<?xml version="1.0" encoding="utf-8"?>








I read that you need to set app_name in strings.xml under /res but I have no clue where /res/value is in the project(I added it to all /res/value files I could find), which here is that code.

<?xml version="1.0" encoding="utf-8"?> PlatformVR

Sorry for any wrong formatting, I have never posted here in the forums.

2 Likes

I think you should use @anon_76954444 /app_name (lowercase s)

same here, when i try to use gradle for build, related to my post here Unity 2017.1 Android build error

@chuck666 what is the exact error you are getting ?

any fixes yet guys?

1 Like

I was having similar issues (on macOS rather than Windows however) today and what solved it for me was changing the JDK version in External Tools. It had automatically selected 1.7 despite me having 1.8 installed, so I set it to the most recent version and everything built fine.

2 Likes

I downloaded Google VR SDK and tried to build the demo scene named “hello vr”. I am using JDK 1.8 and Unity 2017.3.0f3, I am still getting this error. I tried with JDK 1.9 as well but there is no improvement. Please help.

1 Like

that true.

any news guys

1 Like

I was able to fix the “Gradle build failed” error by installing older Java version - (Java SE Development Kit 8u161) and updating the pathway in Unity Preferneces>External tools> JDK to the older Java.

2 Likes
8 Likes

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I changed JDK from 9 to 8. I could build apk ! Please try it.

2 Likes

I am using JDK 8 (Java SE Development Kit 8u161) and i am still getting grade build error please help!

4 Likes

I had the same problem and solved in the following way. My problem is install the last Android SDK Build Tools 28 RC1 after uninstall problem solved.

15 Likes

@muratti32 you saved me! Was stuck on this for far too long. Tried all kinds of solutions. Thanks!

hey guys!
I have the same problem, and i can’t fix it…
I tried doing what @muratti32 said, but it still doesn’t work.
Any suggestions?

3433521--271410--upload_2018-3-21_14-32-6.png

I was having the same problem when I saw that I did not have NDK, I downloaded it and I’m testing it, if it works, I’ll return the result to you

CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_121\bin\java.exe -classpath “C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx2048m” “assembleRelease”

stderr[

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘gradleOut’.

The SDK Build Tools revision (23.0.3) is too low for project ‘gradleOut’. Minimum required is 25.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 5s
]
stdout[
NDK is missing a “platforms” directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

… No, it did not work.


Okay, it worked, switch from Gradle to Internal

12 Likes

@Alef_Ribeiro yeah, that works. but then you won’t be able to export project into android studio…
There should be a solution for this…
(Edit: it didn’t work that way for me either… “failed to assign APK”)