程序类型已经存在:org.hamcrest.CoreMatchers [英] Program type already present: org.hamcrest.CoreMatchers

查看:86
本文介绍了程序类型已经存在:org.hamcrest.CoreMatchers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建我的应用程序时,出现跟随错误.

When i build my app, I got follow error.

程序类型已经存在:org.hamcrest.CoreMatchers

Program type already present: org.hamcrest.CoreMatchers

消息{种类=错误,文本=程序类型已存在:org.hamcrest.CoreMatchers,源= [未知源文件],工具名称=可选.of(D8)}

Message{kind=ERROR, text=Program type already present: org.hamcrest.CoreMatchers, sources=[Unknown source file], tool name=Optional.of(D8)}

我在Google上遇到了我的问题,并在这里找到了类似的问题,但无法获得正确的答案.

I have google my problem and fond the similar question here , but can't get the proper answer .

这是我的build.gradle文件

This is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        ndk {
            ndk {
                moduleName "exec"
                abiFilters 'armeabi-v7a'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jni.srcDirs = []
            jniLibs.srcDirs = ['libs']
            res.srcDirs = ['src/main/res']
            assets.srcDirs = ['src/main/assets']
            manifest.srcFile 'src/main/AndroidManifest.xml'
        }
    }
    configurations.all{
        resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.1'
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.j256.ormlite:ormlite-core:4.41'
    implementation 'com.j256.ormlite:ormlite-android:4.41'
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    implementation 'org.mozilla:rhino:1.7.10'
}

感谢您的帮助!

推荐答案

下载json-simple 1.1.1的jar文件并将其放在libs文件夹中.

Download jar file of json-simple 1.1.1 and put it in libs folder.

然后从build.gradle中删除implementation 'com.googlecode.json-simple:json-simple:1.1.1'.

我不知道为什么这可以解决问题,因为我根本不知道为什么会出现此问题.

I don't know why this solves the problem because I don't know why this problem occurs at all.

这篇关于程序类型已经存在:org.hamcrest.CoreMatchers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆