我和Gradle有错误

时间:2017-10-25 18:22:12

标签: android android-studio gradle sdk

我有问题,谁可以帮助我?

我在3个月之前使用Android Studio 3制作了一个应用程序。 我尝试用Android Studio 2打开应用程序,但不起作用。 所以现在我安装了Android Stuido 3但它也不起作用:(

这是我的Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.1.1"
    defaultConfig {
        applicationId "com.learnjava.vgpro"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 4
        versionName "3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

        implementation 'com.android.support:appcompat-v7:26.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.android.gms:play-services-ads:10.2.4'

}

这就是问题:

Error:(23, 0) Could not find method implementation() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
<a href="openFile:C:\Users\JamilHammash\Desktop\LearnJava\app\build.gradle">Open File</a>

1 个答案:

答案 0 :(得分:0)

将您的gradle版本更新为版本3,例如

   classpath 'com.android.tools.build:gradle:3.0.0-rc2'

否则替换:

testImplementation with testCompile 

一个

implementation with compile  

应该帮助