android - 错误 : more than one library with package name 'com.github.xinthink.rnmk'

标签 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'

这似乎是由 react-native-material-kit (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')

这些是来自 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')
}

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

最佳答案

抱歉,我还不能发表评论。我认为问题在于您在 settings.gradlebuild.gradle 中使用了多个此库。

因此转到您的 build.gradle 并删除 compile "com.facebook.react:react-native:+"。希望它 有效。

关于android - 错误 : more than one library with package name 'com.github.xinthink.rnmk' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37328031/

相关文章:

java - 无法使用 Gradle 在 IntelliJ Community Edition 中添加应用程序服务器

javascript - 在 React 中实现子数据结构

javascript - React/Redux 组件重新渲染

reactjs - React Navigation 丢失传递下来的 props

java - 如何在 Dagger 2 中使用@Scope

java - 自定义对话框 onClickListener

android - 如何在CmakeList中添加目标链接库.so和.a文件?

java - Sonarqube 集成到 gitlab.com 上的私有(private)仓库

android - 从 GridView 中的缩略图扩展图像

cordova - 从 Cordova 将自定义 maven 存储库添加到 build.gradle