android - Unity导出的android项目中的gradle错误

标签 android unity-game-engine gradle export

我将使用构建配置属性“multiDexEnabled true”来打破以下链接的 64K 方法限制 https://developer.android.com/studio/build/multidex.html#about

我更新为使用 unity 5.6.1f1 和 android studio 2.3.3。我将“构建系统”选项设置为“Gradle(New)”,这是从5.5新添加的,然后单击“导出”创建一个android项目。

我用android studio打开导出的项目,然后出现以下错误 /image/MdrQI.png

我尝试了两个蓝色链接,但我一直得到相同的结果。

对于我的 Unity 项目,我仅创建一个空项目并向 Unity 场景添加一个按钮,然后将其导出。我也尝试过直接构建API,它有效。

将unity项目导出到andoid studio项目对我来说很重要,因为它可以帮助我们使用额外的编译选项

有人知道我想念什么吗?或者如何正确导出unity工程?

谢谢

gradle错误文本,如果看不到图像链接

错误:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection 无法转换为 org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection 导致此意外错误的可能原因包括:

  • Gradle 的依赖项缓存可能已损坏(有时会在网络连接超时后发生。) 重新下载依赖项并同步项目(需要网络)
  • Gradle 构建过程(守护进程)的状态可能已损坏。停止所有 Gradle 守护进程可能会解决此问题。 停止 Gradle 构建过程(需要重新启动)
  • 您的项目可能正在使用第三方插件,该插件与项目中的其他插件或所请求的 Gradle 版本不兼容
如果 Gradle 进程损坏,您还可以尝试关闭 IDE,然后终止所有 Java 进程。

最佳答案

我在使用 unity 2017.1.0b4 和 Android Studio 2.3.3、gradle 3.3 时遇到了同样的问题。

您应该将Android studio中的gradle版本的android插件更改为2.3.3

You can specify the Android plugin for Gradle version in either the File > Project Structure > Project menu in Android Studio, or the top-level build.gradle file. The plugin version applies to all modules built in that Android Studio project. The following example sets the Android plugin for Gradle to version 2.3.3 from the build.gradle file:

buildscript {
  ...
  dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
  }
}

https://developer.android.com/studio/releases/gradle-plugin.html

关于android - Unity导出的android项目中的gradle错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45007518/

相关文章:

android - 非 Activity 中的 Xamarin ContentResolver/CursorLoader 访问

android - 如何让 C2DM 推送通知与启用的 WiFi 一起工作?

c# - 更改 MRTK v2.1 中指针的图层蒙版

c# - 如何在多边形内生成随机 Vector3 点

maven - 在哪里使用Gradle找到构建 Artifact

spring-boot - Spring Boot bootRun 持续构建

java - Gradle构建错误Error converting bytecode to dex :Cause: com. android.dex.DexException:Multiple dex files define Landroid/arch/lifecycle/liveData$1

Android PDF页面转图片api

android - 无法解析com.github.navasmdc:MaterialDesign:1.5

ios - 如何在 ARKit (Unity) 中锚定大型 3D 模型?