错误“无法获取未知属性'com'”(android)

时间:2019-12-30 09:33:28

标签: java android gradle

美好的一天,我仍然无法正确连接Apache POI库,我读到我需要添加“ --core-library”和“ packagingOptions”。但是在他们之后,一个错误突然出现。到目前为止,我还没有将文件添加到项目结构中。 预先感谢您的帮助。

错误文字:

  

错误:无法为类型com.android.build.gradle.internal.dsl.BaseAppModuleExtension的对象获取未知属性'com'。   打开文件

Gradle.build:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        multiDexEnabled true  // this line will solve this problem
        applicationId "com.example.jone1.navigation_drawer"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        multiDexEnabled true
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    configurations.all {
        resolutionStrategy {
            force 'com.android.support:support-v4:27.1.0'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
    }
    project.tasks.withType(com.android.build.gradle.tasks.Dex) {
        additionalParameters=['--core-library'] //javax namespace fix
    }

    buildTypes {
        release {
            multiDexKeepFile file('multidex-config.txt')
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }



}

dependencies {
    implementation group: 'org.apache.poi', name: 'poi', version: '4.1.1'
    //implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'org.bouncycastle:bcprov-jdk15on:1.56'
    implementation 'org.bouncycastle:bcpkix-jdk15on:1.56'
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    androidTestImplementation 'junit:junit:4.12'
    testImplementation 'junit:junit:4.12'
}

0 个答案:

没有答案