我尝试将Parse.com与Android Studio一起使用,但是在设置所有内容时,我一直收到错误:
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>
这是我的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')
}
答案 0 :(得分: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')
}
答案 1 :(得分:0)
您似乎错过了buildscript
,请尝试将其添加到build.gradle
文件的根目录中:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
此外,您似乎尝试连接两次相同的依赖项。如果您的项目的JAR文件的文件结构为root/libs
,请尝试将compile fileTree(dir: 'libs', include: ['*.jar'])
添加到您的依赖项中,如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':photoView')
compile 'com.android.support:support-v4:22.2.0'
}