错误:包含名称为"com.github.xinthink.rnmk"的多个库

ami*_*rfl 1 android gradle react-native

使用React-Native为Android构建应用程序失败,并显示此错误

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'
Run Code Online (Sandbox Code Playgroud)

这似乎是由反应原生材料试剂盒(RNMK)引起的.但是在Sublime Text中搜索所有项目文件,我找不到任何重复的'com.github.xinthink.rnmk'.作为参考,iOS版本的应用程序运行正常.

编辑

这是我的settings.gradle文件:

rootProject.name = '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')
Run Code Online (Sandbox Code Playgroud)

这些是build.gradle的依赖:

dependencies {
    compile project(':react-native-vector-icons')
    compile project(':react-native-material-kit')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':RNMaterialKit')
}
Run Code Online (Sandbox Code Playgroud)

当我从依赖项(最后一行)注释掉' compile project(':RNMaterialKit') '时,应用程序构建并开始正常.但是,这样做可能会破坏使用该软件包的react-native-material-kit.

BOU*_*lid 6

对不起,我还不能发表评论.我认为问题在于你在你的settings.gradle和你的中使用了多个这个库build.gradle.

所以去你的build.gradle并删除compile "com.facebook.react:react-native:+".希望它有效.