1

my Gradle suddenly decided not to build my project anymore, and I have no idea. I suspect its because its on dropbox, but it hasnt been a problem for the month Ive worked on it. I have not edited anything in my build files. I updated java JDK to newest, and made sure the project is pointed to it. The gradle look like this;

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

android {
    compileSdkVersion 22
}
dependencies {
}

and

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.nan.spymap"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories { mavenCentral() }

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')

    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
    compile 'com.google.android.gms:play-services:7.8.0'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.android.support:design:22.2.0'

}
NicklasN
  • 484
  • 1
  • 7
  • 20

1 Answers1

1

build.gradle file of project (top-level) must not contain android root tag. Try to remove it.

Beloo
  • 9,723
  • 7
  • 40
  • 71
  • Hi, Im very new at gradle and how it builds, can you be more specific about what particular line? – NicklasN Sep 30 '15 at 22:42
  • i'm about android { compileSdkVersion 22 } in your top file – Beloo Sep 30 '15 at 22:43
  • If I remove android { compileSdkVersion 22 } – NicklasN Sep 30 '15 at 22:49
  • I get another error.. Task "not found in root project" – NicklasN Sep 30 '15 at 22:49
  • with this error you can check http://stackoverflow.com/questions/25172006/android-studio-build-fails-with-task-not-found-in-root-project-myproject. As i read there you should try just clean project and make sure you use default gradle wrapper – Beloo Sep 30 '15 at 23:03
  • Tried to clean project, and restart. Now Android studio wont even try to build my project. I have no idea what to do ... Ive read that link, it doesnt help when I dont know what to look for. – NicklasN Sep 30 '15 at 23:09
  • So strange. And what error message does AS print? Or nothing? You could try clean cache, reimport project and run gradlew command from terminal staying in root folder. – Beloo Sep 30 '15 at 23:28
  • Im back to "Gradle DSL method not found" with adding back the android compileSdk. I tried invalidating cache.. Reimporting. Just reinstalled android studio. What root folder for gradlew? Gradles root folder? – NicklasN Sep 30 '15 at 23:34
  • Running gradlew in root of project; "FAILURE: Build failed with an exception" again pointing to android() mehtod – NicklasN Sep 30 '15 at 23:38