Build Gradle错误“名称不能为空”

时间:2019-08-07 14:19:20

标签: android-studio gradle android-gradle-plugin build.gradle

我已经将编译和测试编译更改为实现和testImplementation,但是仍然出现此错误:

  

名称不能为空

...对于依赖项中的这一行:

implementation(dir: 'libs', include: ['*.jar'])

有什么我可以解决的吗?

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23

defaultConfig {
    applicationId "com.fruitmarket";
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1

    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
}
lintOptions {
    disable "ResourceType"
}

useLibrary 'org.apache.http.legacy'

}
repositories {
maven {
    // Used for downloading dependency com.github.lkorth:device-automator
    url "https://jitpack.io"
}
mavenCentral()
}

dependencies {
implementation(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.13-beta-3'
implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'
implementation group: 'org.apache.httpcomponents' , name: 'httpclient- 
android' , version: '4.3.5.1'
implementation('org.apache.httpcomponents:httpmime:4.3') {
    exclude module: "httpclient"
}
compile('com.paypal.sdk:paypal-android-sdk:2.13.3') {
    //exclude group: 'io.card'
}

implementation "com.google.android.gms:play-services-gcm:9.0.0"
implementation 'com.karumi:dexter:2.3.1'
}

1 个答案:

答案 0 :(得分:0)

尝试一下:

implementation fileTree(include: ['*.jar'], dir: 'libs')