Unity3d构建错误重复类com.google.unity.ads

时间:2019-10-30 11:59:45

标签: c# android unity3d admob

我无法构建我的应用,请帮助我。我尝试了在互联网上看到的所有内容:

  • 删除统一广告包
  • 删除图书馆
  • 更改sdk构建工具版本。

没有任何效果。

我正在使用jdk 1.8.161(我尝试过这些; 191、181,但仍然无法正常工作)

我的项目中没有统一广告。

CommandInvokationFailure: Gradle build failed.

C:/Program Files/Java/jdk1.8.0_161\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.google.unity.BuildConfig found in modules classes.jar (:googlemobileads-unity:) and unity-plugin-library.jar (unity-plugin-library.jar)
  Duplicate class com.google.unity.ads.AdNetworkExtras found in modules classes.jar (:googlemobileads-unity:) and unity-plugin-library.jar (unity-plugin-library.jar)
  Duplicate class com.google.unity.ads.Banner found in modules classes.jar (:googlemobileads-unity:) and unity-plugin-library.jar (unity-plugin-library.jar)


  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* 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

BUİLD FAILED in 1m 40s
]
stdout[
> Task :preBuild UP-TO-DATE
> Task :GoogleMobileAdsPlugin:preBuild UP-TO-DATE
> Task :GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE
> Task :GoogleMobileAdsPlugin:checkReleaseManifest
> Task :GoogleMobileAdsPlugin:processReleaseManifest
> Task :checkReleaseManifest
> Task :generateReleaseBuildConfig
> Task :prepareLintJar
> Task :generateReleaseSources
> Task :GoogleMobileAdsPlugin:compileReleaseRenderscript NO-SOURCE
> Task :GoogleMobileAdsPlugin:generateReleaseRFile
> Task :GoogleMobileAdsPlugin:prepareLintJar
> Task :GoogleMobileAdsPlugin:generateReleaseSources
> Task :GoogleMobileAdsPlugin:javaPreCompileRelease
> Task :GoogleMobileAdsPlugin:compileReleaseJavaWithJavac
> Task :GoogleMobileAdsPlugin:bundleLibCompileRelease
> Task :javaPreCompileRelease
> Task :mainApkListPersistenceRelease
> Task :generateReleaseResValues
> Task :generateReleaseResources
> Task :mergeReleaseResources
> Task :createReleaseCompatibleScreenManifests
> Task :processReleaseManifest
> Task :processReleaseResources
> Task :compileReleaseJavaWithJavac
> Task :GoogleMobileAdsPlugin:mergeReleaseShaders
> Task :GoogleMobileAdsPlugin:compileReleaseShaders
> Task :GoogleMobileAdsPlugin:generateReleaseAssets
> Task :GoogleMobileAdsPlugin:packageReleaseAssets
> Task :mergeReleaseAssets
> Task :validateSigningRelease
> Task :signingConfigWriterRelease
> Task :checkReleaseDuplicateClasses FAILED


1 个答案:

答案 0 :(得分:0)

我不确定是否可以使用,但是在解决所有这些错误之后,我关闭了Unity,删除了我的项目 Library 文件夹并选择了Unity。

项目库文件夹

enter image description here

希望对您有帮助

如果它不起作用,您将获得更多信息here