1

I’m working on a project where I need to establish connection to printer with ESC-POS. Project is in react native and I currently test on Android emulator. I’ve found package that would do what I need (https://github.com/leesiongchan/react-native-esc-pos) but when I try to build an app it gives over 330 errors like:

Duplicate class org.junit.runners.model.MultipleFailureException found in modules escposjava-1.0-SNAPSHOT.jar (escposjava-1.0-SNAPSHOT.jar) and junit-4.12.jar (junit:junit:4.12)`

Those errors occur for task :app:mergeDebugJavaResource and the messages are:

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'junit/runner/logo.gif'

I tried to apply answers from this question: More than one file was found with OS independent path 'META-INF/LICENSE' but nothing has changed.

Any help would be apprecieated.

Project dependencies

"dependencies": {
    "@leesiongchan/react-native-esc-pos": "^0.8.0",
    "@react-native-community/datetimepicker": "^2.6.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/bottom-tabs": "^5.5.2",
    "@react-navigation/drawer": "^5.9.0",
    "@react-navigation/material-top-tabs": "^5.2.16",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "axios": "^0.19.2",
    "currency.js": "^2.0.3",
    "formik": "^2.1.4",
    "i18n-js": "^3.7.0",
    "moment": "^2.27.0",
    "native-base": "^2.12.1",
    "react": "16.13.1",
    "react-native": "0.62.2",
    "react-native-calendars": "^1.300.0",
    "react-native-elements": "^2.3.2",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-html-to-pdf": "^0.8.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.2",
    "react-native-localize": "^1.4.0",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "^11.5.6",
    "react-native-modal-datetime-picker": "^8.7.1",
    "react-native-paper": "^3.10.1",
    "react-native-print": "^0.6.0",
    "react-native-reanimated": "~1.7.0",
    "react-native-safe-area-context": "0.7.3",
    "react-native-screens": "~2.2.0",
    "react-native-size-matters": "^0.3.0",
    "react-native-sqlite-storage": "modified for project",
    "react-native-tab-view": "^2.14.4",
    "react-native-vector-icons": "6.6.0",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-saga": "^1.1.3",
    "reflect-metadata": "^0.1.13",
    "typeorm": "modified for project",
    "url": "^0.11.0",
    "yup": "^0.29.1"
  },
Variag
  • 1,056
  • 10
  • 25
  • 1
    you should exclude de duplicate class. In your dependencies implementation('com.android.junit:4.x.x', { exclude group: 'groupname', module: 'modulename' }) – anthony willis muñoz Sep 14 '20 at 11:47

1 Answers1

0

I kept searching other questions related to android and finally found this:

Duplicate Hamcrest and JUnit classes after updating Gradle and Android Studio to 3.5

So basically all I did was to add to build.gradle (:app)

android {
    ...

    configurations {
        compile.exclude group: "junit", module: "junit"
    }

    ...
}

Now project builds and app starts.

Variag
  • 1,056
  • 10
  • 25