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')
}
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')
}
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'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.