0

I'm trying to use Parse.com with Android Studio, however when setting everything up I keep getting the error:

Error:(8, 0) Gradle DSL method not found: 'compile()'
Possible causes:<ul><li>The project 'REUProject' 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.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

Here is my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "edu.fiu.mpact.reuproject"
        minSdkVersion 14
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':photoView')
    compile 'com.android.support:support-v4:22.2.0'
    compile files('libs/Parse-1.9.2.jar')
    compile files('/Users/Rachelle/AndroidStudioProjects/REUProject/libs/Parse-1.9.2.jar')
}
coder4lyf
  • 877
  • 1
  • 9
  • 31
  • get the gradle wrapper installed in project folder : http://stackoverflow.com/questions/25769536/how-when-to-generate-gradle-wrapper-files – Robert Rowntree Jun 11 '15 at 20:56

2 Answers2

0
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "edu.fiu.mpact.reuproject"
        minSdkVersion 14
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':photoView')
    compile 'com.android.support:support-v4:22.2.0'
    compile files('libs/Parse-1.9.2.jar')
    compile files('/Users/Rachelle/AndroidStudioProjects/REUProject/libs/Parse-1.9.2.jar')
}
Vivart
  • 13,137
  • 5
  • 32
  • 65
0

It looks like you're missing the buildscript, try adding this to the root of your build.gradle file:

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

Also, it looks like you're trying to link to the same dependency twice. If your project's file structure is root/libs for your JAR files, try just adding compile fileTree(dir: 'libs', include: ['*.jar']) to your dependencies like so:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':photoView')
    compile 'com.android.support:support-v4:22.2.0'
}
Cruceo
  • 6,574
  • 2
  • 27
  • 48