错误:找不到参数[目录'libs']的方法Implementation()

时间:2019-12-23 09:21:08

标签: android android-studio

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.example.administrator.barcode2ds"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
   }
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation '<u>com.android.support:appcompat-v7:26.0.0-alpha1</u>'
testImplementation 'junit:junit:4.12'
implementation files('libs/cw-deviceapi20171026.jar')
 }

错误:

ERROR: Could not find method implementation() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

1 个答案:

答案 0 :(得分:0)

implementation '<u>com.android.support:appcompat-v7:26.0.0-alpha1</u>'
在此行中的

从依赖项的开头和结尾处删除,然后进行同步。最后应该是这样:

implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'