【问题标题】:Gradle not syncing for Parse.com in Android StudioGradle 未在 Android Studio 中同步 Parse.com
【发布时间】:2015-06-11 20:01:07
【问题描述】:

我正在尝试将 Parse.com 与 A​​ndroid 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')
}

【问题讨论】:

标签: java android android-studio parse-platform gradle


【解决方案1】:
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')
}

【讨论】:

    【解决方案2】:

    您似乎缺少 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'
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-24
      • 2022-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多