问题描述
我有一个React Native项目,当我分离该项目时,该项目由自动生成。 现在,我在使用react native链接添加react-native-lock之后遇到了这些构建错误。 作为带有xcode的iOS项目,它可以正常工作,但是android studio给我这个错误:
Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.facebook.react'
还有build.grade文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
defaultConfig {
applicationId "com.foo.app"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
manifestPlaceholders = [
'appAuthRedirectScheme': 'com.foo.app'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "8g"
}
}
task exponentPrebuildStep(type: Exec) {
workingDir '../../'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', '.\\.exponent-source\\android\\detach-scripts\\prepare-detached-build.bat'
} else {
commandLine './.exponent-source/android/detach-scripts/prepare-detached-build.sh'
}
}
preBuild.dependsOn exponentPrebuildStep
repositories{
flatDir{
dirs 'libs'
}
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-lock')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:multidex:1.0.0'
compile('host.exp.exponent:exponentview:13.0.0@aar') {
exclude module: 'bolts-android'
transitive = true;
}
}
和反应本机锁定
repositories {
jcenter()
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '24.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "0.4.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
ext.libraries = [
testing: [
dependencies.create('junit:junit:4.11') {
exclude module: 'hamcrest-core'
},
'org.robolectric:robolectric:3.0-rc3',
'com.google.guava:guava:18.0',
'org.hamcrest:hamcrest-integration:1.3',
'org.hamcrest:hamcrest-core:1.3',
'org.hamcrest:hamcrest-library:1.3',
'org.mockito:mockito-core:1.10.19',
dependencies.create('com.squareup:fest-android:1.0.+') {
exclude group: 'com.android.support', module: 'support-v4'
},
'org.powermock:powermock-api-mockito:1.6.3',
'org.powermock:powermock-module-junit4-rule:1.6.3',
'org.powermock:powermock-classloading-xstream:1.6.3'
]
]
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-v4:23.+'
compile 'com.facebook.react:react-native:+'
compile 'com.auth0.android:lock:1.17.+'
compile 'com.auth0.android:lock-passwordless:1.17.+'
testCompile libraries.testing
}
1楼
从更改build.gradle
compile project(':react-native-lock')
至
compile(project(':react-native-lock')) { exclude module: 'react-native' }
如此处所记录: :