I am just trying to compile the latest version of u2020-daggr2 in Android stu![e I imported it as a gradle project. But I get error complaining about gradle! I did edit the gradle-wrapper.properties. Rebuilding however did not work. I did see: Gradle 2.1 is required Migrate to Gradle wrapper and sync project which seems like same issue but on Studio I did not find:
我正在尝试在Android stu中编译最新版本的u2020-daggr2 !我把它作为一级工程进口的。但是我对等级的抱怨是错误的!我编辑了gradle-wrap .properties。然而,重建工作没有成功。我确实看到了:level 2.1被要求迁移到Gradle包装器和sync项目中,这似乎是同样的问题,但是在Studio中我没有发现:
Settings -> Gradle and click Use default gradle wrapper (recommended).
设置->等级和点击使用默认的等级包装(推荐)。
I did not find where to do this in Studio. First off there is no menu that just says Setting. There is : File->Other Setting->Default Setting. But nothing but gradle vm parameters etc. Nothing about using default gradle wrapper. Do I need to have a local copy of gradle 2.1 for this to work? ![enter image description here][4]
我在演播室里找不到这样做的地方。首先,菜单上没有设置。有:File->其他设置->默认设置。但是除了gradle vm参数之外什么都没有,没有使用默认的gradle包装器。我是否需要一个本地版本的第2.1等级才能工作?![在这里输入图像描述][4]
gradle wrapper.properties is edited as such: distributionUrl=https://services.gradle.org/distributions/gradle-2.1-all.zip
gradle包装。属性的编辑如下:distributionUrl=https://services.gradle.org/distributions/gradle 2.1-all.zip
Error:(20) A problem occurred evaluating root project 'u2020-dagger2'.
错误:(20)评估根项目“u2020-dagger2”时出现的问题。
Failed to apply plugin [id 'com.android.application'] Gradle version 2.1 is required. Current version is 2.2.1. If using the gradlewrapper, try editing the distributionUrl in /Users/Mac1/Downloads/u2020-dagger2 /gradle/wrapper/gradle-wrapper.properties to gradle-2.1-all.zip
未能应用插件[id 'com.android]。需要第2.1版。当前版本是2.2.1。如果使用gradlewrapper,试着编辑/Users/Mac1/Downloads/u2020-dagger2 /gradle/wrapper/gradle-wrapper中的distributionUrl。gradle - 2.1 all.zip属性
2 个解决方案
#1
5
You have to use this gradle-plugin in your build.gradle
你必须在你的build.gradle中使用这个等级插件
classpath 'com.android.tools.build:gradle:1.1.0'
Android Studio 1.1.0 requires:
Android工作室1.1.0要求:
-
Gradle 2.2.1 (you can set this value in the
gradle-wrapper.properties
)Gradle 2.2.1(您可以将该值设置为Gradle -wrapper.properties)
-
Gradle plugin 1.0.0/1.1.0 (you can set this value in your
build.gradle
)Gradle plugin 1.0.0/1.1.0(您可以在您的build.gradle中设置此值)
#2
6
click on your build.gradle file in project explorer and make changes as
单击您的构建。在项目资源管理器中创建渐变文件并对其进行修改
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2
}
ReBuild your project! Hope this helps.
重建你的项目!希望这个有帮助。
#1
5
You have to use this gradle-plugin in your build.gradle
你必须在你的build.gradle中使用这个等级插件
classpath 'com.android.tools.build:gradle:1.1.0'
Android Studio 1.1.0 requires:
Android工作室1.1.0要求:
-
Gradle 2.2.1 (you can set this value in the
gradle-wrapper.properties
)Gradle 2.2.1(您可以将该值设置为Gradle -wrapper.properties)
-
Gradle plugin 1.0.0/1.1.0 (you can set this value in your
build.gradle
)Gradle plugin 1.0.0/1.1.0(您可以在您的build.gradle中设置此值)
#2
6
click on your build.gradle file in project explorer and make changes as
单击您的构建。在项目资源管理器中创建渐变文件并对其进行修改
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2
}
ReBuild your project! Hope this helps.
重建你的项目!希望这个有帮助。