amirfl amirfl - 7 months ago 54
Android Question

Error: more than one library with package name 'com.github.xinthink.rnmk'

Building an app for Android with React-Native fails with this error

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.github.xinthink.rnmk'

This seems to be caused by react-native-material-kit (RNMK). but searching all the project files in Sublime Text, I couldn't find any duplication of 'com.github.xinthink.rnmk'.
For reference, the iOS version of the app runs fine.


This is my settings.gradle file: = 'myAppName'

include ':app'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-material-kit'
project(':react-native-material-kit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-material-kit/android')
include ':RNMaterialKit'
project(':RNMaterialKit').projectDir = file('../node_modules/react-native-material-kit/android')

And these are the dependencies from build.gradle:

dependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-material-kit')
compile fileTree(dir: "libs", include: ["*.jar"])
compile ""
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':RNMaterialKit')

When I comment out 'compile project(':RNMaterialKit')' from the dependencies (the last line), The App builds and starts fine. However, doing so probably breaks react-native-material-kit, that uses that package.


Sorry i can't put a comment yet. I think the problem is that you use more than one this library, in your settings.gradle and in your build.gradle.

So go to your build.gradle and delete compile "com.facebook.react:react-native:+". Hope it works.