android - Android Studio无法同步Gradle项目

标签 android cordova gradle android-gradle-plugin

我正在尝试构建一个cordova应用。
但是当我尝试构建它时,出现以下错误消息:

Error:Cause: org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.



我实际上是android开发的新手,我很迷路。

希望有人可以指导我解决这个问题。

最佳答案

如果您使用的是Android Studio,请从Android项目资源管理器中找到gradle-wrapper.properties,打开它,更改distributionUrl行,例如以下内容(2.14.1只是一个示例):

distributionUrl = https://services.gradle.org/distributions/gradle-2.14.1-all.zip

然后重新构建,这可以解决此问题。

关于android - Android Studio无法同步Gradle项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39337883/

相关文章:

javascript - 如何在 Controller 之前加载.run

javascript - 是否有必要减少 phonegap 应用程序对本地资源的请求?

spring - 使用Spring设计和实现Web应用程序教程中有什么问题

android - 为什么我的图像被压缩了?

android - 如何在 AlertDialog 中显示数组列表

java - 如何在listView的每一行中一一显示上传进度条?

android - 如何使用 dart/flutter 中的共享首选项保存和获取列表列表

ios - Sencha Touch、Phonegap、IOS、键盘顶部工具栏

android - 如何在gradle中并行生成productFlavors

jenkins - Jenkins-Groovy脚本返回了退出代码126