Fix Gradle Incompatibility Issue When Importing Android Sample Sample

Android Studio (0.5.3) is driving me crazy.

I have never had serious problems with Eclipse and ADT. Android Studio is another story: I could not create one project with it.

So, I'm trying to import an Android sample project (which I suppose has the correct Gradle settings and should be ready to import):

C:\pathToMyAndroidSDK\sdk\samples\android-19\content\StorageProvider

The first error I get is the following:

Failed to refresh Gradle project 'StorageProvider'
The project is using an unsupported version of Gradle. Please use version 1.10.
Please point to a supported Gradle version in the project Gradle settings or in the project Gradle wrapper (if applicable.)
Fix Gradle wrapper and re-import project Gradle settings

OK, so I download Gradle 1.10 and change the parameters of the Gradle project so that it uses this local Gradle distribution instead of the standard Gradle shell (which seems to be included in the sample project).

This time I get another error:

Failed to refresh Gradle project 'StorageProvider'
The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Version 0.9.0 introduced incompatible changes in the build language.
Please read the migration guide to learn how to update your project.

I don't know Gradle enough to migrate the configuration myself, and I really don't want to.

Gradle Gradle 1.10 ( )? .

. android-19, .


EDIT:

, Linux (gradlew build).

, , build.gradle:

classpath 'com.android.tools.build:gradle:0.9.+'

classpath 'com.android.tools.build:gradle:0.8.+' #(the original configuration of the sample project)

, Android Studio.

+4
3

gradle, .

Android Studio -, , .

, Android Studio: https://developer.android.com/sdk/installing/studio-build.html

AS 0.5.3, gradle 1.10/1.11 gradle 0.9.x

, build.gradle script :

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

0.8.3.

gradle 1.10/1.11. project_folder/ gradle/wrapper, gradle -wrapper.properties.

distributionUrl :

distributionUrl = HTTP://services.gradle.org/distributions/ gradle -1.10-all.zip

Android Studio - gradle - gradle :

Android Studio gradle 0.5.0 - gradle 0,8 0,9 - Android Studio 0.8.1

, gradle script .

+5

, , , , Android Studio gradle.

gradle -wrapper.properties( ) gradle 2.10

gradle -wrapper.properties, : https://docs.gradle.org/current/userguide/gradle_wrapper.html

Choosing to solve the gradle version problem

+1

, :

enter image description here

+1
source

Source: https://habr.com/ru/post/1533953/