2.1摇篮需要迁移到摇篮的包装和同步工程 [英] Gradle 2.1 is required Migrate to Gradle wrapper and sync project

查看:184
本文介绍了2.1摇篮需要迁移到摇篮的包装和同步工程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立 U202 机器人由杰克沃顿商学院项目。我的机器人工作室未能生成项目。所显示的错误是如下:

I am trying to build u202 android project by Jake Wharton. My android studio is failing to build the project. The error being shown is as below:

Gradle 2.1 is required 
Migrate to Gradle wrapper and sync project

,其中错误显示指向该行适用的插件:com.android.application build.gradle 文件。

我曾尝试以下解决方案,但无济于事。

I have tried the following solutions but to no avail.

  1. 运行 gradlew 从最高的项目目录。然而,当我运行这个命令行,我得到一个信息,即构建成功,但是当我尝试同步在机器人工作室的项目,我得到上述错误。
  2. 在通过命令行运行摇篮。由于摇篮的版本,我曾在我的道路是2.2.1版本,我得到的插件com.android.application无法找到错误 - 我想这是因为我有这个版本的摇篮 - 插件的项目,该项目需要进行更新,以支持新摇篮的版本:com.android.tools.build:gradle:0.13.3
  1. Run gradlew from the highest project directory. However when I run this from command line, I get a message that the build was successful but when I try to sync the project in android studio I get the above mentioned error.
  2. Run gradle through command line. Since the gradle version I had in my path was of version 2.2.1, I got the error that plugin "com.android.application" cannot be found - I assume this is because I have this version of gradle-plugin in the project which needs to be updated to support newer version of gradle: 'com.android.tools.build:gradle:0.13.3'

最后,我可以通过手动下载2.1摇篮,并指出该项目使用,而不是包装当地摇篮构建项目。我想知道是否有什么错在我试图用摇篮的包装方式。

Finally I could build the project by downloading gradle 2.1 manually and pointing the project to use local gradle instead of wrapper. I wanted to know if there is anything wrong in the way I tried to use gradle wrapper.

推荐答案

设置 - >摇篮,点击使用默认摇篮包装(推荐)。 preSS 应用

Go to Settings -> Gradle and click Use default gradle wrapper (recommended). Press Apply.

在这之后前往项目目录/摇篮/包装/ gradle-wrapper.properties 和变化 distributionUrl 像因此:

After that go to project-dir/gradle/wrapper/gradle-wrapper.properties and change distributionUrl like so:

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

尝试构建 - >使项目

您可能还需要确保所有组件(Android的工作室,摇篮本身和Android摇篮插件)可以一起使用。请查看此页面,在这里我们可以看到,摇篮2.1可以在Android 0.9.0工作室使用 - 0.9.3和摇篮的插件必须是版本0.14.0 - 0.14.4。

You also may need to make sure that all components (Android Studio, Gradle itself and Android Gradle plugin) can be used together. Check out this page, here we can see that Gradle 2.1 can be used on Android Studio 0.9.0 - 0.9.3 and Gradle plugin has to be of version 0.14.0 - 0.14.4.

这篇关于2.1摇篮需要迁移到摇篮的包装和同步工程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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