Android Studio - Program type already present: org.hamcrest.CoreMatchers

天大地大妈咪最大 提交于 2019-12-03 12:48:23

There is a similar problem with simple-json in another question that I answered here. I suggest you do the same for monkeylearn-java and junit or any other non-google dependencies one by one, I mean download their jar files and put them in the libs folder one by one, to find out which one is the problem, and leave it be in libs folder.

I think this is a bug either in Android Studio or in Gradle.

I had a similar problem with simple-json. For that the solution was to exclude the JUnit dependency.

I am not an expert on Android programming but I find it strange that you exclude hamcrest-core from the JUnit testImplementation. I would rather suggest to exclude transitive dependencies from external libs.

For simple-json this was my solution:

implementation('com.googlecode.json-simple:json-simple:1.1.1') {
    exclude group: 'junit', module: 'junit'
}

Maybe you can do the same for monkeylearn-java?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!