java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并dex归档文件时出错

时间:2019-02-20 23:40:53

标签: android android-studio dependencies

我正在编写一个程序以在数据库中插入数据并将其保存,但是在编译该类以连接到服务器时遇到了问题。那是错误:

  

java.lang.RuntimeException:   com.android.builder.dexing.DexArchiveMergerException:时出错   合并dex归档文件

那是build.gradle(模块):

Wrong 2nd argument type

这就是build.gradle(project):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.registerlogin"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/ASL2.0'
        exclude 'org/apache/http/version.properties'
        exclude 'org/apache/http/client/version.properties'
    }
}

android {
    useLibrary 'org.apache.http.legacy'
}
dependencies
        {
            implementation fileTree(include: ['*.jar'], dir: 'libs')
            testImplementation 'junit:junit:4.12'
            implementation 'com.android.support:appcompat-v7:28.0.0'
            implementation 'com.android.support:recyclerview-v7:28.0.+'
            implementation 'org.apache.httpcomponents:httpcore:4.4.1'
            implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
            implementation group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation "cz.msebera.android:httpclient:4.4.1.1"
            implementation group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'

        }

我还写了我在课堂上导入的库:

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我仍然是使用Android Studio编写代码并解决其他问题的新手,我在依赖项中合并了其他内容,我不知道问题是否可能在那里。

非常感谢!!

0 个答案:

没有答案