Stuck on Building Android (ARDK 2.4.2)

Hi everyone,

I am getting the following issues when building for Android:

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

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/foundrysix/Documents/Dev/Unity/MetaDice_Files/MetaDice/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’.
Could not create an instance of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
Could not create an instance of type com.android.build.gradle.internal.dsl.TestOptions.
Could not create an instance of type com.android.build.gradle.internal.dsl.TestOptions$UnitTestOptions.
org.gradle.api.internal.DefaultDomainObjectSet.(Ljava/lang/Class;)V

  • 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.

BUILD FAILED in 1s

UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
Niantic.ARDK.AR.WayspotAnchors.Editor._RemoteAuthoringPresenceManager:OnBuild (UnityEditor.BuildPlayerOptions) (at Assets/ARDK/Editor/RemoteContent/_RemoteAuthoringPresenceManager.cs:170)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

and also:

CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath “/usr/local/Cellar/gradle/8.0.2/libexec/lib/gradle-launcher-8.0.2.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”

Environment Variables:
XPC_SERVICE_NAME = application.com.unity3d.unityhub.79650954.79650960
XPC_FLAGS = 0x0
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
MallocNanoZone = 0
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
SHELL = /bin/zsh
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.lVKJQ8A9U6/Listeners
HOME = /Users/foundrysix
PATH = /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

__CFBundleIdentifier = com.unity3d.unityhub
USER = foundrysix
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
TMPDIR = /var/folders/7d/cmkbvc453y3g55hqmjtn5vv40000gn/T/
LOGNAME = foundrysix
JAVA_HOME = /Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/OpenJDK
COMMAND_MODE = unix2003

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

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/foundrysix/Documents/Dev/Unity/MetaDice_Files/MetaDice/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’.
Could not create an instance of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
Could not create an instance of type com.android.build.gradle.internal.dsl.TestOptions.
Could not create an instance of type com.android.build.gradle.internal.dsl.TestOptions$UnitTestOptions.
org.gradle.api.internal.DefaultDomainObjectSet.(Ljava/lang/Class;)V

  • 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.

BUILD FAILED in 1s
]
stdout[

Configure project :launcher
WARNING: The option ‘android.enableR8’ is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.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 Command-Line Interface
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action1[T] progress) (at <4a8943a7ff7048deb64e0a5059f78d1d>: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 <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>: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 <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <4a8943a7ff7048deb64e0a5059f78d1d>: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 /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
UnityEditor.DefaultBuildMethods:BuildPlayer(BuildPlayerOptions)
Niantic.ARDK.AR.WayspotAnchors.Editor._RemoteAuthoringPresenceManager:OnBuild(BuildPlayerOptions) (at Assets/ARDK/Editor/RemoteContent/_RemoteAuthoringPresenceManager.cs:170)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

  • Host machine & OS version: Macbook Pro M1 2020 (Ventura)
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • ARDK version: 2.4.2
  • Unity version: 2021.3.8f1

Hello Antony,

Can you verify that you’ve followed all the instructions for our Android build guide? This includes using an updated Gradle version 6.7.1 or higher and setting the plugin version to 4.2.0 in the Custom Base Gradle Template. Additionally, make sure you didn’t make any changes to the Android Manifest. All you have to do is check the box for Custom Main Manifest and Unity will fill in everything else automatically.

Before you took a look at the console errors, did you also get an error box that popped up with a message? If so, can you share a screenshot?

OMG, thank you!!! I had my gradle build number 7.5.1 in there for plugin version. I think 4.2.0 made all the difference :stuck_out_tongue_winking_eye:. That said, I’d done a complete rebuild using 2020.3.2fl instead of 2021.3.14f1. Made sure there were permissions for the camera. Is it critical to have permissions and/or keystores to make the build work? Can you use newer versions of Unitiy?