Hi, I am trying to integrate LevelPlay in my project (I followed this video for the setup: https://www.youtube.com/watch?v=sU5njx1jn8w&t=495s). I went through all the necessary steps and setup IronSource with 2 networks: UnityAds and Google AdMob. I am not 100% sure of this, but I believe the build worked before adding GooleAdMob, but now I get this error:
Java seems to spit out a lot of unnecessary garbage, but I think the more relevant errors are the following:
> Task :launcher:mergeReleaseJavaResource FAILED
82 actionable tasks: 8 executed, 74 up-to-date
------------------------------------------------------------------
> CommandInvokationFailure: Gradle build failed.
> C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
------------------------------------------------------------------
> stderr[
> Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
>
> FAILURE: Build completed with 2 failures.
>
> 1: Task failed with an exception.
> -----------
> * What went wrong:
> Execution failed for task ':unityLibrary:mergeReleaseJavaResource'.
> > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> > 2 files found with path 'META-INF/kotlinx_coroutines_core.version' from inputs:
> - D:\DEV\Unity\Unity_ADS_Template\UnityADS_Template\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\org.jetbrains.kotlinx.kotlinx-coroutines-core-1.7.1.jar
> - D:\DEV\Unity\Unity_ADS_Template\UnityADS_Template\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm-1.7.1.jar
> Adding a packagingOptions block may help, please refer to
> https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
> for more information
>
> * 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.
> ==============================================================================
>
> 2: Task failed with an exception.
> -----------
> * What went wrong:
> Execution failed for task ':launcher:mergeReleaseJavaResource'.
> > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> > 2 files found with path 'META-INF/kotlinx_coroutines_core.version' from inputs:
> - D:\DEV\Unity\Unity_ADS_Template\UnityADS_Template\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\org.jetbrains.kotlinx.kotlinx-coroutines-core-1.7.1.jar
> - D:\DEV\Unity\Unity_ADS_Template\UnityADS_Template\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm-1.7.1.jar
> Adding a packagingOptions block may help, please refer to
> https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
> for more information
>
> * 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.
>
What I have tried:
Setting the target API Level to 32, 33, 34, and 35
Setting custom main gradle template (This seems to automatically delete all Android dependencies that the dependency resolver installs, which seems wrong, but the error is still there)
Running a “force resolve” with the Android dependency resolver tool
Adding “android.useAndroidX=true” and “android.enableJetifier=true” to the gradleTemplate
Setting a more up-to-date gradle installation in the Preferences->External Tools (particularly “gradle-7.6.3” and “gradle-8.9”
I am on Unity 2022.3.7f1.
If anyone came across this, Please do let me know how to fix it🙏
That worked for some reason . I just don’t understand how the whole “dependencies” thing works. If I add a custom Main gradle template, all the Android dependencies installed by the Android resolver are deleted (and once they are deleted, the build keeps failing again). Does it mean that I need to manually add them to the template?