程序类型已经存在:org.hamcrest.CoreMatchers [英] Program type already present: 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屋!