My android project don't build, graddle failed

Hi everyone,

I try to build my android project to do some test with google admob but it does not want to be built.
I have check Custom Main Gradle Template and Custom Gradle Properties Template.

I don’t know what to do to build this project

I have 3 errors message :

message 1

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Message 2

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Projet Unity\TestPub\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin 'com.android.internal.application'.
   > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.

* 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 4s

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Message 3

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

Environment Variables:
PROCESSOR_ARCHITECTURE = AMD64
JAVA_HOME = C:\Program Files\Java\jdk-22
DriverData = C:\Windows\System32\Drivers\DriverData
USERDOMAIN = DESKTOP-RV65C5B
BLENDER_PATH = C:\Program Files\Blender Foundation\Blender 4.0\blender.exe
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
COMPUTERNAME = DESKTOP-RV65C5B
DEBUG_ENV_VAR = UnityHub
LOGONSERVER = \\DESKTOP-RV65C5B
ProgramData = C:\ProgramData
SESSIONNAME = Console
USERPROFILE = C:\Users\gogma
ALLUSERSPROFILE = C:\ProgramData
SystemRoot = C:\Windows
windir = C:\Windows
ProgramFiles(x86) = C:\Program Files (x86)
ProgramW6432 = C:\Program Files
OS = Windows_NT
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
HOMEPATH = \Users\gogma
FPS_BROWSER_USER_PROFILE_STRING = Default
PROCESSOR_LEVEL = 6
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
CommonProgramFiles = C:\Program Files\Common Files
PUBLIC = C:\Users\Public
USERDOMAIN_ROAMINGPROFILE = DESKTOP-RV65C5B
TEMP = C:\Users\gogma\AppData\Local\Temp
ProgramFiles = C:\Program Files
CommonProgramW6432 = C:\Program Files\Common Files
HOMEDRIVE = C:
USERNAME = gogma
OneDrive = C:\Users\gogma\OneDrive
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
NUMBER_OF_PROCESSORS = 20
ComSpec = C:\Windows\system32\cmd.exe
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
PROCESSOR_REVISION = b701
EFC_7596 = 1
TMP = C:\Users\gogma\AppData\Local\Temp
SystemDrive = C:
OneDriveConsumer = C:\Users\gogma\OneDrive
APPDATA = C:\Users\gogma\AppData\Roaming
Path = C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;%JAVA_HOME%\bin;C:\Users\gogma\AppData\Local\Programs\Python\Launcher\;C:\Users\gogma\AppData\Local\Microsoft\WindowsApps;C:\Users\gogma\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\gogma\.dotnet\tools;C:\Users\gogma\AppData\Local\GitHubDesktop\bin;E:\Programme\OpenCV\opencv\build\x64\vc16\bin;
PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
LOCALAPPDATA = C:\Users\gogma\AppData\Local
FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer


stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Projet Unity\TestPub\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin 'com.android.internal.application'.
   > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.

* 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 4s
]
stdout[
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <eb865e8041b4430e8b16e0e96097bf17>: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 <eb865e8041b4430e8b16e0e96097bf17>: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 <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <eb865e8041b4430e8b16e0e96097bf17>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

android.enableR8 in your Gradle properties template should be either true or false

1 Like

I remove the line for R8 because I got an error if I wrote “=true” or “=false”
I try to build and I got another error :

Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-32\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:validateDependencies UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJarForPublish UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :launcher:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:extractProguardFiles UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:parseReleaseLocalResources UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest UP-TO-DATE
> Task :unityLibrary:processReleaseManifest UP-TO-DATE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
> Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:javaPreCompileRelease UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseNativeLibs NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:stripReleaseDebugSymbols NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE
> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileToJarRelease
> Task :unityLibrary:generateReleaseRFile UP-TO-DATE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :unityLibrary:prepareReleaseArtProfile UP-TO-DATE
> Task :unityLibrary:processReleaseJavaRes UP-TO-DATE
> Task :unityLibrary:mergeReleaseJavaResource UP-TO-DATE
> Task :unityLibrary:writeReleaseAarMetadata UP-TO-DATE
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
> Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
> Task :unityLibrary:bundleLibResRelease UP-TO-DATE
> Task :unityLibrary:writeReleaseLintModelMetadata UP-TO-DATE
> Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:extractReleaseAnnotations
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseGeneratedProguardFiles
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseConsumerProguardFiles
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseAssets UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareReleaseArtProfile UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJavaResource UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:syncReleaseLibJars
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:writeReleaseAarMetadata UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleReleaseLocalLintAar
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:extractDeepLinksRelease UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseLibraryResources UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibResRelease NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:writeReleaseLintModelMetadata UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:copyReleaseJniLibsProjectOnly UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibRuntimeToJarRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:createFullJarRelease
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :launcher:mergeReleaseResources UP-TO-DATE
> Task :launcher:checkReleaseAarMetadata FAILED
> Task :unityLibrary:extractReleaseAnnotations

> Task :launcher:processReleaseMainManifest
[:googlemobileads-unity:] C:\Users\gogma\.gradle\caches\transforms-3\60eaa1aacc78e1eeb9ac89093d0932a0\transformed\jetified-googlemobileads-unity\AndroidManifest.xml Warning:
	Package name 'com.google.unity.ads' used in: :googlemobileads-unity:, :unityLibrary:GoogleMobileAdsPlugin.androidlib.

> Task :launcher:desugarReleaseFileDependencies

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
64 actionable tasks: 13 executed, 51 up-to-date

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)