4

First of all, I've read all other solution posts and the official documentation on migrating to 1.0. So far, none has worked.

Error:

Error:(23, 0) Gradle DSL method not found: 'classpath()'
Possible causes:<ul><li>The project 'SparkDatabase' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.

Apply Gradle plugin

Currently, this is my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "ca.industrycorp.sparkdatabase"
        minSdkVersion 19
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'de.greenrobot:greendao:1.3.7'
    compile 'de.greenrobot:greendao-generator:1.3.1'
    compile files('libs/json-simple-1.1.1.jar')
    compile files('libs/java-json.jar')
}

My other gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Alternatively: How do I make a fresh installation of Android Studio 1.0 that would simply work out of the box, without having to relate to the 0.9 that I had before?

user3830885
  • 43
  • 1
  • 5
  • I had no luck upgrading from a version that was < 1.0. I downloaded the app and installed a fresh copy. – Kristy Welsh Feb 19 '15 at 20:21
  • My top-level gradle file looks like yours except the repository is mavenCentral rather than jcenter. I don't know anything about it, but could there be a different syntax or keyword when using jcenter? Also your question text doesn't match the error message. – nasch Feb 19 '15 at 20:34
  • Did you fix it by switching to mavenCentral, or something else? – nasch Feb 19 '15 at 23:19
  • @nasch I basically reinstalled it, but this time, after uninstallation, I went to Android and Android Studio folders and deleted all the trailing files that I could before installation. I tried reinstallation without doing that before, and the error persisted. – user3830885 Feb 20 '15 at 15:37

2 Answers2

3

By putting classpath in top level build.gradle , it solved the issue for me.

charany1
  • 871
  • 2
  • 12
  • 27
2

There are 2 build.gradle files. I found this error when I was adding classpath in the first one(The file that had all complied dependencies). The other one already had some classpath lines(or whatever you call them).