Cannot build my Andriod unity game.

0 views
Skip to first unread message

Yuqiang Jin

unread,
7:03 PM (3 hours ago) 7:03 PM
to Google Mobile Ads SDK Developers
Hello Google Mobile Ads SDK team, 
  I tried to add admob into my unity game, but I cannot build the Andriod version. This is my build enviroment: unity 2020.3.48 jdk: 17 gradle: 8 (the subversion is not clear, i will update it in the future) admob: V10.5.0

  There are two errors:
1: Task failed with an exception.
-----------
What went wrong:
A problem occurred configuring project ':unityLibrary:GoogleMobileAdsPlugin.androidlib'.
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Specify a namespace in the module's build file: E:\MyPath\Temp\gradleOut\unityLibrary\GoogleMobileAdsPlugin.androidlib\build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

2: Task failed with an exception.
-----------
What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@60fab28b of type BuildFlowService.Parameters
A problem occurred configuring project ':unityLibrary:GoogleMobileAdsPlugin.androidlib'.
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Specify a namespace in the module's build file: E:\Mypath\Temp\gradleOut\unityLibrary\GoogleMobileAdsPlugin.androidlib\build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.  

I tried use this link to solve this problem https://developers.google.com/admob/unity/android?hl=zh-cn#2019.4---2021.3.37f1, but I do not find build.gradle underi the "GoogleMobileAdsPlugin.androidlib" folder. If I add one ,there will be many duplicated class error like this:
  • What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.unity3d.ads.BuildConfig found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2)
Duplicate class com.unity3d.ads.IUnityAdsInitializationListener found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2) Duplicate class com.unity3d.ads.IUnityAdsLoadListener found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2) Duplicate class com.unity3d.ads.IUnityAdsShowListener found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2) Duplicate class com.unity3d.ads.IUnityAdsTokenListener found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2) Duplicate class com.unity3d.ads.UnityAds found in modules UnityAds.aar -> jetified-UnityAds-runtime (:UnityAds:) and unity-ads-4.16.2.aar -> jetified-unity-ads-4.16.2-runtime (com.unity3d.ads:unity-ads:4.16.2) How can I solve this problem? Any help will be greatly appreciated!
Thanks in advance for your help.
Reply all
Reply to author
Forward
0 new messages