Unity 2018.3 android dex合并问题 [英] Unity 2018.3 android dex merging issue

查看:386
本文介绍了Unity 2018.3 android dex合并问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在您决定甚至不阅读该帖子就将其视为重复"之前,请了解我看过与该主题相关的大量帖子,并且找不到适合我实例的解决方案,包括所有实例该StackOverflow建议.大多数帖子是针对Android Studio的,而非统一的.

Before you decide to dismiss this post as "duplicate" without even reading it, understand that I have looked at a TON of posts related to this topic and I can't find a solution for my instance, including all of the ones that StackOverflow suggested. Most of the posts are for Android Studio instead of unity.

尝试构建到android时,我的错误是在Unity中给出的,它在此处崩溃.

My error is given in Unity when trying to build to android, it crashes here.

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[
D8: Program type already present: com.unity3d.ads.BuildConfig

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

我已经尝试过使用build.gradle文件更改内容,就像很多帖子所建议的那样,但是我什么也做不了.

I've tried changing stuff with a build.gradle file like a lot of posts suggest, but I can't get anything to work.

该错误在Unity 2018.2中不存在.我在更新之前进行了检查,但此更新现在引发了此问题.

The error didn't exist in Unity 2018.2. I checked right before I updated, but the update is now throwing this issue.

有人在这里有关于UNITY的具体想法吗?我已经尝试了很多事情,但是没人能帮助我.

Does anyone have any UNITY specific ideas what to do here? I've tried so many things and nobody's post has been able to help me yet.

感谢您的帮助

推荐答案

当您添加与compileSdkVersion不兼容的库时,可能会发生此错误. 在您的情况下,您可以拥有默认情况下未统一导入的库(现在是) 或构建工具版本可能有问题. (您可以尝试更新它们)

This error probably happens when you add a library which is not compatible with your compileSdkVersion. In your case you can have libs that were not imported by default by unity (and now are) or there can be a problem with the Build Tools version. (You can try updating them)

我之前有几个版本有类似的问题,但我不记得如何解决. 我还没有时间升级到unity 2018.3. (因此,提示更像是猜测,但是它可以帮助您解决问题.)

I had similar problem a few versions ago, but I don't remember how I fixed it. I didn't have time to upgrade to unity 2018.3 yet. (So the tips are more like guesses, but it may help you solve the issue.)

这篇关于Unity 2018.3 android dex合并问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆