thirdweb-dev / unity-sdk

Best in class web3 SDK for Unity games
https://thirdweb-dev.github.io/unity-sdk/
Apache License 2.0
113 stars 66 forks source link

Android build fails due to error "execution failed for task ':unityLibrary:compileReleaseJavaWithJavac" #205

Open MrVeit opened 1 week ago

MrVeit commented 1 week ago

Hi, an error occurs when building for android, after importing the latest version of SDK. After initially importing the SDK into the project, 4 duplicate errors occurred. The first one was related to Newtonsoft as it was already in the project, so the extra .dll file was removed. There were also duplicate errors for the BouncyCastle .dll, which is in Plugins and is also a WalletConnectUnity dependency (it was removed just like that)

Unity 2021.3.22f1. Min API: 26 Target API: 33

Scripting Backend: IL2CPP Stripping Level: Minimal.

Error: stderr[ C:\Unity\Work\MobileGame-Saunposium\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\ThirdwebActivity.java:28: error: cannot find symbol builder.setUrlBarHidingEnabled(true); ^ symbol: method setUrlBarHidingEnabled(boolean) location: variable builder of type Builder 1 error

FAILURE: Build failed with an exception.

BUILD FAILED in 10s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ] stdout[ Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details

Configure project :launcher WARNING:: The option setting 'android.enableR8=false' is deprecated. It will be removed in version 7.0 of the Android Gradle plugin. You will no longer be able to disable R8 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 http://developer.android.com/r/tools/jcenter-end-of-service for more information. Currently detected usages in: root project 'Gradle', project ':launcher', project ':unityLibrary'
0xFirekeeper commented 1 week ago

The error suggests you're missing a library that we add using ThirdwebDependencies.xml and that is resolved using the included External Dependency Resolver. To solve it include androidx.browser yourself if you removed our xml, or run the resolver from Assets > ExternalDependencyManager > Android Resolver > Force Resolve. The packages are typically included with our unity package under root/Plugins/Android, if you do not see it make sure to run the resolver again.

MrVeit commented 1 week ago

So do you have to use your EDM? I already had it in my project and installed it locally via tallbar, not as an imported package via .unityPackage.

0xFirekeeper commented 1 week ago

It should still work, try exploding aars in its settings and make sure androidx.browser is added

MrVeit commented 1 week ago

Okay, I'll give it a try)