简体   繁体   English

Gradle无法在Android Studio中同步Parse.com

[英]Gradle not syncing for Parse.com in Android Studio

I'm trying to use Parse.com with Android Studio, however when setting everything up I keep getting the error: 我正在尝试将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>

Here is my build.gradle: 这是我的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 ,请尝试将其添加到build.gradle文件的根目录中:

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: 如果项目的文件结构是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'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM