Build project with Gradle 2.2.1 and Android Studio 1.2.2

I want to switch to Android Studio from Eclipse, then download the k9mail open source project and decide to import it into AS. I am not familiar with AS and Gradle and is building the system. I am installing Android Studio version 1.2.2 and Gradle 2.2.1.

When I install version 2.2.1 or 2.4 on top of Gradle I see below error:

Error:Could not find com.android.tools.build:gradle:2.2.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android    Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
Required by:
:k-9-master:unspecified

      

I go to this directory (C: / Program Files / ...), I don't have the 2.2.1 folder, I only have the 1.1.0 and 1.2.3 folder.

When I changed version 1.0.0 of Gradle I give below error:

Error:(22, 0) Gradle DSL method not found: 'android()'
Possible causes:The project 'k-9-master' may be using a version of Gradle that does not contain the method.
The build file may be missing a Gradle plugin.
Apply Gradle plugin

      

I've had these errors for about one week. I'm tired. I'm in a loop if change 2.2.1 has one bug and there is another bug for change 1.1.0 or 1.0.0 or 1.2.3 :(

Please, if you have any knowledge, please share with me. I am confused and I am not using Intelij before.

+3


source to share


1 answer


You are misleading

  • gradle

  • gradle plugin for android

At the top level, build.gradle

you have to specify the gradle plugin:



classpath 'com.android.tools.build:gradle:1.2.3'

      

In gradle/wrapper/gradle-wrapper.properties

you need to specify the gradle version:

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

      

+6


source







All Articles