Build fails when outputting ardk-samples-3.0.0

ardk-samples build to ardroid has been tested on many unity versions but does not work.
But you can successfully build the case you made step by step.

  • Issue category: Bulid Android
    Framework
  • Device type & OS version: Android
  • Host machine & OS version: Windows10
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • ARDK version:3.0.0
  • Unity version:2022.3.6f1c1

Description of the issue:
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

Configure project :
Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle’
Build was configured to prefer settings repositories over project repositories but repository ‘BintrayJCenter’ was added by build file ‘build.gradle’
Build was configured to prefer settings repositories over project repositories but repository ‘flatDir’ was added by build file ‘build.gradle’
WARNING:: Using flatDirs should be avoided because it doesn’t support any meta-data formats.
Currently detected usages:

  • repository flatDir used in: root project ‘Gradle’, project ‘:launcher’, project ‘:unityLibrary’, …
    WARNING:: Please remove usages of jcenter() Maven repository from your build scripts and migrate your build to other Maven repositories.
    This repository is deprecated and it will be shut down in the future.
    See JCenter service update  |  Android Studio  |  Android Developers for more information.
    Currently detected usages in: root project ‘Gradle’, project ‘:launcher’, project ‘:unityLibrary’, …

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

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:launcher:compileReleaseJavaWithJavac’.

Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager.

  • 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 8s

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

Hi Fuhua,

Did you happen to try version 2022.3.10f1? That’s the version we officially support and mention in the documentation.

Yes, I have tried all new Unity versions of Windows 10. Never succeeded.
It is worth mentioning that as long as I delete the PersistentAR and SharedAR folders under Samples, the new version of unity can be built successfully.
For this reason, I just bought a mac mini M2 system to test the 2021.3.29f1 silicon version, but the build still failed, prompting that gradle6.7.1 was required, and then replaced it with the latest version of gradle8.5 in 2021.3.29f1. No improvement. I’m trying the 2022.3.10f1 you mentioned to see what the final result is.
Thank you for your reply! I would like to use ardk to implement an AR project. Perhaps due to limitations of vps, consider using SharedAR ImageTrackingColocalization under Samples to achieve initial positioning.

Yes, I have tried all new Unity versions of Windows 10. Never succeeded.
It is worth mentioning that as long as I delete the PersistentAR and SharedAR folders under Samples, the new version of unity can be built successfully.
For this reason, I just bought a mac mini M2 system to test the 2021.3.29f1 silicon version, but the build still failed, prompting that gradle6.7.1 was required, and then replaced it with the latest version of gradle8.5 in 2021.3.29f1. No improvement. I’m trying the 2022.3.10f1 you mentioned to see what the final result is.
Thank you for your reply! I would like to use ardk to implement an AR project. Perhaps due to limitations of vps, consider using SharedAR ImageTrackingColocalization under Samples to achieve initial positioning.

[Discourse post]

I just tested 2022.3.10f1 under the macOS sonoma 14.2 system. When I opened ardk sample main, unity showed that The project you are opening contains compilation errors. You need to enter safe mode.
Things looked bad. :grin:

I just tested 2022.3.15f1 under the macOS sonoma 14.2 system and successfully opened ardk sample main, but the build result failed was the same as in the windows system.

In Windows system I tested 2022.3.6f1c1, 2022.3.12f1c1 and 2022.3.14f1c1.
The worst thing about the current mac and window systems is that 2022.3.10f1 will enter safe mode.

The second is 2021.3.29f1, which just prompts the gradle version problem.

I found what’s wrong, and how to fix.
In short it is an incompatibility between older Android Gradle Plugin and newer Build Tools.

Option 1) Manual mending of the Build Tools. ⇒ stackoverflow

  1. Firstly, locate your SDK folder, e.g. %ANDROID_SDK_ROOT%.
  2. Copy (NOT Rename) %ANDROID_SDK_ROOT%\build-tools\32.0.0\d8.bat to %ANDROID_SDK_ROOT%\build-tools\32.0.0\dx.bat
  3. Copy (NOT Rename) %ANDROID_SDK_ROOT%\build-tools\32.0.0\lib\d8.jar to %ANDROID_SDK_ROOT%\build-tools\32.0.0\lib\dx.jar
  4. Verify if build issue has been fixed.

for Unity look for the location something like this.

C:\Program Files\Unity\Hub\Editor\2022.3.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0

Option 2) Update Android Gradle Plugin. ardk-samples are using 4.2.0 . For Unity 2022.3 , Android Gradle Plugin 7.1.2 is probably a good choice. Where to change? it is this line here ↓
https://github.com/niantic-lightship/ardk-samples/blob/main/Assets/Plugins/Android/baseProjectTemplate.gradle#L13

Hope this info helps.

Hi Fuhua,

Sorry for the delay, for some reason I wasn’t notified about your reply. After looking at the reply from elfmimi I would recommend giving option 1 a try. This was an old issue from the earlier days of ARDK but it still crops up from time to time. I would advise against option 2 because not all Gradle version work with ARDK but if 7.1.2 worked for elfmimi then I would say you can give that one a try if you prefer to go with option 2.

Please reply with any new information if that doesn’t help. I’ll keep an eye out on your post to make sure I get back to you sooner.

very good! Thanks for your answer! I’ll give it a try.

Thank you so much!

I tried both of this solutions and successfuly build the apk
Thanks

1 Like

It still doesn’t seem to work after using elfmimi’s Option 1 method. Option 2 has not been used yet.

On Mac, also with Unity ver 2022.3.17f
I tried Option 1 above and not working :sob:
going to try Option 2 now :crossed_fingers:

Also tried open 2 Option 2 ) Update Android Gradle Plugin.
Note: I couldn’t find 7.1.2. I tried 6.7.1 / 7.2.2 / 7.6.2 but kept getting this message
Screenshot 2024-01-25 at 20.37.49

I kept trying to publish anyway and got this message:

Configure project :
Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle’
Build was configured to prefer settings repositories over project repositories but repository ‘BintrayJCenter’ was added by build file ‘build.gradle’
Build was configured to prefer settings repositories over project repositories but repository ‘flatDir’ was added by build file ‘build.gradle’
WARNING:: Using flatDirs should be avoided because it doesn’t support any meta-data formats.
Currently detected usages:

  • repository flatDir used in: root project ‘Gradle’, project ‘:launcher’, project ‘:unityLibrary’, …
    WARNING:: Please remove usages of jcenter() Maven repository from your build scripts and migrate your build to other Maven repositories.
    This repository is deprecated and it will be shut down in the future.
    See JCenter service update  |  Android Studio  |  Android Developers for more information.
    Currently detected usages in: root project ‘Gradle’, project ‘:launcher’, project ‘:unityLibrary’, …

Task :unityLibrary:preBuild UP-TO-DATE
Task :launcher:preBuild UP-TO-DATE
Task :unityLibrary:xrmanifest.androidlib:preBuild UP-TO-DATE
Task :launcher:preReleaseBuild UP-TO-DATE
Task :unityLibrary:preReleaseBuild UP-TO-DATE
Task :unityLibrary:xrmanifest.androidlib:preReleaseBuild UP-TO-DATE
Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:compileReleaseAidl NO-SOURCE
Task :launcher:generateReleaseBuildConfig
Task :launcher:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:compileReleaseAidl NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:generateReleaseResValues
Task :unityLibrary:writeReleaseAarMetadata
Task :unityLibrary:xrmanifest.androidlib:writeReleaseAarMetadata
Task :unityLibrary:xrmanifest.androidlib:generateReleaseResValues
Task :launcher:writeReleaseApplicationId
Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:generateReleaseResources
Task :unityLibrary:generateReleaseResources
Task :launcher:javaPreCompileRelease
Task :launcher:compileReleaseAidl NO-SOURCE
Task :launcher:analyticsRecordingRelease
Task :launcher:generateReleaseResValues
Task :launcher:generateReleaseResources
Task :launcher:createReleaseCompatibleScreenManifests
Task :launcher:extractDeepLinksRelease
Task :unityLibrary:xrmanifest.androidlib:packageReleaseResources
Task :unityLibrary:xrmanifest.androidlib:extractDeepLinksRelease
Task :launcher:mergeReleaseJniLibFolders
Task :launcher:mergeReleaseShaders
Task :launcher:compileReleaseShaders NO-SOURCE
Task :launcher:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:packageReleaseResources
Task :launcher:checkReleaseDuplicateClasses
Task :unityLibrary:extractDeepLinksRelease
Task :unityLibrary:xrmanifest.androidlib:parseReleaseLocalResources
Task :unityLibrary:xrmanifest.androidlib:compileReleaseLibraryResources
Task :unityLibrary:xrmanifest.androidlib:generateReleaseBuildConfig
Task :unityLibrary:xrmanifest.androidlib:processReleaseManifest
Task :unityLibrary:xrmanifest.androidlib:javaPreCompileRelease
Task :unityLibrary:compileReleaseLibraryResources
Task :unityLibrary:generateReleaseBuildConfig
Task :unityLibrary:javaPreCompileRelease
Task :unityLibrary:processReleaseManifest
Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:parseReleaseLocalResources
Task :unityLibrary:processReleaseJavaRes
Task :unityLibrary:bundleLibResRelease
Task :unityLibrary:xrmanifest.androidlib:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:xrmanifest.androidlib:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:bundleLibResRelease NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:mergeReleaseJniLibFolders
Task :unityLibrary:xrmanifest.androidlib:mergeReleaseNativeLibs NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:stripReleaseDebugSymbols NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:generateReleaseRFile
Task :unityLibrary:xrmanifest.androidlib:copyReleaseJniLibsProjectOnly
Task :unityLibrary:xrmanifest.androidlib:mergeReleaseShaders
Task :unityLibrary:xrmanifest.androidlib:compileReleaseShaders NO-SOURCE
Task :unityLibrary:xrmanifest.androidlib:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:xrmanifest.androidlib:packageReleaseAssets
Task :unityLibrary:mergeReleaseJniLibFolders
Task :unityLibrary:xrmanifest.androidlib:compileReleaseJavaWithJavac
Task :unityLibrary:xrmanifest.androidlib:bundleLibRuntimeToDirRelease
Task :unityLibrary:xrmanifest.androidlib:bundleLibCompileToJarRelease
Task :unityLibrary:mergeReleaseShaders
Task :unityLibrary:compileReleaseShaders NO-SOURCE
Task :unityLibrary:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:generateReleaseRFile
Task :unityLibrary:packageReleaseAssets
Task :launcher:checkReleaseAarMetadata
Task :unityLibrary:mergeReleaseNativeLibs

Task :launcher:processReleaseMainManifest
[:arcore_client:] /Users/garywillmott/.gradle/caches/transforms-3/50599e640f853571185f9c3d4c3f7036/transformed/arcore_client/AndroidManifest.xml Warning:
Package name ‘com.google.ar.core’ used in: :arcore_client:, :unityandroidpermissions:.

Task :launcher:processReleaseManifest
Task :launcher:processReleaseManifestForPackage

Task :unityLibrary:compileReleaseJavaWithJavac FAILED

Task :launcher:mergeReleaseResources
Task :launcher:mergeReleaseAssets
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 Command-Line Interface
53 actionable tasks: 51 executed, 2 up-to-date

UnityEditor.EditorApplication:Internal_CallGlobalEventHandler () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:474)

6.7.1 / 7.2.2 / 7.6.2

It seems you are trying different versions of Gradle. No. What you need to change is the version of AGP, Android Gradle Plugin.

Option 3) Just uncheck “Custom Base Gradle Template” .

Thankselfmimi.

By the way, I am currently using Lightship to create an AR project for a tourist attraction in China,

I learned through the forum that VPS cannot be used for location in China.

Currently, Image Tracking Colonization is used for localization.

The problem I am currently facing is that there may be position and rotation drift at the positioning point after scanning the image for positioning.

Do we have a better way to deal with these issues? To meet the needs of commercialization.

Can we pay a certain fee to achieve the effect of VPS positioning.

We really need it!

1 Like

Hey all,

I’ll be addressing you all in one message to not spam you all too many times.

@fuhua_sun I’m not sure if you’ve tried @elfmimi latest suggestion that they titled Option 3. Just one thing to note is that Option 3 isn’t really an option, it’s one of the steps in Option 2 and is mandatory. I’m noticing that our documentation for the ARDK 3 setup doesn’t cover that so I’ll make sure to let our team know that it needs to be added in.

@Gary2 If you’re using Unity 2022+, you don’t need to use a custom gradle version. That only applies to 2021 because the version of Gradle that 2021 comes with isn’t new enough to work with ARDK, but 2022 does not have that issue. Please submit a separate topic for us to look into your issue as this topic is about a month and a half old now. It’ll be easier for us to track a newer topic :slight_smile:

Lastly, @fuhua_sun image tracking should still be fairly reliable. Can you please submit a new topic so that we can look into this since this new issue isn’t related to the gradle build issues? Please include, images, and/ or videos if possible so that we can see what’s happening in the AR Session

1 Like

I was using Unity 2022.3.17 and having Gradle problems, however I just installed 2022.3.15f and it’s working great! However I ended up having to still download and use the latest Gradle

1 Like