错误:(46,0)无法找到属性'编译' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@1e88544b

时间:2016-09-07 23:01:42

标签: java android gradle

我买了一个源代码,我得到了这个错误:

Error:(46, 0) Could not find property 'compile' on
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@1e88544b
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.pongodev.recipesapp"
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 5
        versionName "3.0.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // Main libraries, you always need this libraries in your project. do not remove them.

    // Important library to create material design. do not remove this.
    compile project(':materialDesign')

    // Library to create tabbar

    // Library to create ripple effect. work together with materialDesign library.

    // Library to create rounded, circle, and any shape image.

    // Library load lazy images.

    // Library to create simple list.

    // Library to create complex clickable list.

    // Library to create material dialog.

    // Library to create animation imageview.

    compile
    'com.android.support:appcompat-v7:24.2.0' compile
    'com.android.support:support-v4:24.2.0' compile
    'com.google.android.gms:play-services:9.4.0' compile
    'com.jpardogo.materialtabstrip:library:1.0.6' compile
    'com.github.traex.rippleeffect:library:1.2.2' compile 'com.makeramen:roundedimageview:1.4.0'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.android.support:recyclerview-v7:24.2.0'
    compile 'com.android.support:cardview-v7:24.2.0'
    compile 'com.afollestad:material-dialogs:0.6.0'
    compile 'com.flaviofaria:kenburnsview:1.0.5'
    compile 'com.google.android.gms:play-services-ads:9.4.0'
    compile 'com.google.android.gms:play-services-auth:9.4.0'
    compile 'com.google.android.gms:play-services-gcm:9.4.0'
}

1 个答案:

答案 0 :(得分:1)

如果您正确复制了Gradle构建脚本,则会在最后附近进行复制。 这些行应该在一行上读取compile 'asdfasdfasdf'而不是compile,然后在下一行上读取'asdfasdfasdf' compile

所以块

compile
'com.android.support:appcompat-v7:24.2.0' compile
'com.android.support:support-v4:24.2.0' compile
'com.google.android.gms:play-services:9.4.0' compile
'com.jpardogo.materialtabstrip:library:1.0.6' compile
'com.github.traex.rippleeffect:library:1.2.2' compile 'com.makeramen:roundedimageview:1.4.0'

应该最有可能阅读

compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.6'
compile 'com.github.traex.rippleeffect:library:1.2.2'
compile 'com.makeramen:roundedimageview:1.4.0'