Gradle sync失败:找不到参数的方法compile()

use*_*420 -1 android build.gradle android-gradle-plugin

我在添加新的依赖项后尝试gradle构建项目,build.gradle(Module.app)但得到以下错误.不知道我在这里做错了什么.

依赖试图添加:com.loopj.android:android-async-http:1.4.9

Gradle sync failed: Could not find method complie() for arguments [com.loopj.android:android-async-http:1.4.9] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
        Consult IDE log for more details (Help | Show Log)
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle档案

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        applicationId "com.londonappbrewery.climapm"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.3.1'
    complie 'com.loopj.android:android-async-http:1.4.9'
}
Run Code Online (Sandbox Code Playgroud)

Bob*_*Bob 6

是的compile.没有complie.有一个错字.

实际上,这是一个方法调用.在Groovy中,我们可以留下顶级表达式的括号.这就是为什么你会收到如下错误的原因:

找不到方法complie()