Gradle 2.1 required Transfer to Gradle wrapper and synchronization project

I am trying to create a u202 Android project from Jake Wharton. My android studio cannot build a project. The displayed error looks like this:

Gradle 2.1 is required 
Migrate to Gradle wrapper and sync project

The line in which the error is displayed indicates apply plugin: 'com.android.application'in the file build.gradle.

I tried the following solutions, but to no avail.

  • Run gradlewfrom the oldest project directory. However, when I run this from the command line, I get a message that the assembly was successful, but when I try to synchronize the project in Android studio, I get the above error.
  • Run gradle through the command line. Since the version of gradle in my path was version 2.2.1, I received an error that the plugin "com.android.application" was not found - I assume that this is because I have this version of gradle -plugin in the project, which must be updated to support the newer version of gradle: 'com.android.tools.build:gradlepg.13.3'

Finally, I could create a project by loading gradle 2.1 manually and indicating that the project uses a local gradle instead of a shell. I wanted to know if there was anything wrong with the way I tried to use the gradle wrapper.

+1
source share
1 answer

Scroll to Settings -> Gradleand press Use default gradle wrapper (recommended). Click Apply.

project-dir/gradle/wrapper/gradle-wrapper.properties distributionUrl :

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

Build -> Make Project.

, (Android Studio, Gradle Android Gradle) . , , Gradle 2.1 Android Studio 0.9.0 - 0.9.3 Gradle 0.14.0 - 0.14.4.

+4

All Articles