错误:包名称为"com.facebook.react"的多个库



我有一个反应原生项目,当我分离项目时,它是由 https://getexponent.com/自动生成的。 现在,在我添加了带有反应本机链接的 react-native-lock 后,我遇到了这些构建错误。 它作为带有xcode的iOS项目工作正常,但是android工作室给了我这个错误:

Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.facebook.react'

和构建分级文件

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
}

更改build.gradle

compile project(':react-native-lock') 

compile(project(':react-native-lock')) { exclude module: 'react-native' } 

正如这里记录的那样:https://docs.getexponent.com/versions/v14.0.0/guides/exponentkit.html#make-native-changes

相关内容

  • 没有找到相关文章

最新更新