【发布时间】:2018-06-19 09:59:01
【问题描述】:
当我构建我的应用程序时,我收到了跟随错误。
程序类型已经存在:org.hamcrest.CoreMatchers
Message{kind=ERROR, text=Program type already present: org.hamcrest.CoreMatchers, sources=[Unknown source file], tool name=Optional.of(D8)}
我用谷歌搜索了我的问题并喜欢类似的问题here,但无法得到正确的答案。
这是我的 build.gradle 文件
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'
}
感谢您的帮助!
【问题讨论】:
-
你找到解决办法了吗?
-
@sanevys 是的,我的项目在我删除此依赖项后完成构建
implementation 'com.googlecode.json-simple:json-simple:1.1.1' -
是的,如果我删除依赖关系,它也可以工作。但我需要依赖:/
-
@sanevys 该库是处理 jsonObject ,您可以将其替换为其他库或使用 android 提供的 JSONObject。
-
我正在尝试使用不同的库github.com/Ritaja/java-exchange-rates
标签: android android-gradle-plugin