flixbeat:
Unity version: 2022.3.36f1
My project builds and run without error under unity 2021.3.26f1 (API level 33) but since google requires API level 34, I was forced to upgrade to the latest unity LTS because the build crashes on android 14 devices. Hoping that it gets fixed by the editor upgrade, I get the following error instead after upgrading to 2022.3.36f1 and setting target API level to 34.
Gradle build failed error details:
Where:
Build file 'E:\_Unity Projects\project-name\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'.
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
Google.Android.AppBundle.Editor.Internal.BuildTools.AndroidBuilder:Build (UnityEditor.BuildPlayerOptions) (at Assets/GooglePlayPlugins/com.google.android.appbundle/Editor/Scripts/Internal/BuildTools/AndroidBuilder.cs:178)
Google.Android.AppBundle.Editor.Internal.BuildTools.AppBundleBuilder:BuildAndroidPlayer (UnityEditor.BuildPlayerOptions) (at Assets/GooglePlayPlugins/com.google.android.appbundle/Editor/Scripts/Internal/BuildTools/AppBundleBuilder.cs:179)
Google.Android.AppBundle.Editor.Internal.AppBundlePublisher:Build (Google.Android.AppBundle.Editor.Internal.BuildTools.AppBundleBuilder,Google.Android.AppBundle.Editor.Internal.AppBundlePublisher/AppBundleBuildSettings) (at Assets/GooglePlayPlugins/com.google.android.appbundle/Editor/Scripts/Internal/AppBundlePublisher.cs:188)
Google.Android.AppBundle.Editor.Internal.AppBundlePublisher:Build () (at Assets/GooglePlayPlugins/com.google.android.appbundle/Editor/Scripts/Internal/AppBundlePublisher.cs:152)
Google.Android.AppBundle.Editor.Internal.AppBundleEditorMenu:BuildAndroidAppBundle () (at Assets/GooglePlayPlugins/com.google.android.appbundle/Editor/Scripts/Internal/AppBundleEditorMenu.cs:66)
Build Settings:
I tried removing android.enableR8=MINIFY_WITH_R_EIGHT from gradleTemplate.properties as suggested here: https://discussions.unity.com/t/898522 but then throws new errors:
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.play.core.assetpacks.AssetLocation found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackException found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackExtractionService found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackLocation found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackManager found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackManagerFactory found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackState found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackStateUpdateListener found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.AssetPackStates found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.ExtractionForegroundService found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.NativeAssetPackStateUpdateListener found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.model.AssetPackErrorCode found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.model.AssetPackStatus found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.assetpacks.model.AssetPackStorageMethod found in modules jetified-asset-delivery-2.2.1-runtime (com.google.android.play:asset-delivery:2.2.1) and jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3)
Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.3-runtime (com.google.android.play:core-common:2.0.3)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.3-runtime (com.google.android.play:core-common:2.0.3)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.3-runtime (com.google.android.play:core-common:2.0.3)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.3-runtime (com.google.android.play:core-common:2.0.3)
Deleting resolved libraries and force resolving doesn’t help either.
Regards.
As it states you have two version of play core libraries. There is a known issue where unity adds play-core 1.10 in some unity versions.
For a solution, you need to
First identify if the play core 1.10.3 version is being added by unity or not (if you don’t find the lib in your project, check the final build.gradle file in Library/Bee… after making a build)
If so, use the script we shared over here to avoid the issue.
Cheers,
VB Team