0

How do i import a project downloaded from github which is based on an older gradle version (2.0.0)? here is my build.gradle-

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
    }
}

ext {
    compileSdkVersion = 23
    buildToolsVersion = "23.0.3"

    minSdkVersion = 14
    targetSdkVersion = 23
}

whenever i change the gradle version to 2.1.2 (which is the gradle version used by all my projects), the project gets stuck on the "building.." message and never imports-

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

I even tried replacing the whole build.gradle file with the one in my projects, and still no luck.

Cassie
  • 223
  • 2
  • 12

2 Answers2

1

This is what i do after importing project from Github

There are two gradle files as shown is picture

enter image description here

In first gradle file replace class path with yours

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

now in other gradle file as shown in figure enter image description here

replace these below lines with yours

compileSdkVersion 23
buildToolsVersion "23.0.2"

and

    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

If there are dependencies on libraries than you would require to change them too

Manish Menaria
  • 23,899
  • 3
  • 21
  • 23
0
  1. Also try to check root gradle file and properties.
  2. Use default gradle wrapper . It could be found in File->Settings ->Build->Build Tools->gradle.
  3. disable InstantRun though its require but could be helpful sometimes.
  4. Try this .
Community
  • 1
  • 1
Anurag
  • 1,162
  • 6
  • 20