2017-02-13 384 views
1

當我分離項目時,我有一個由https://getexponent.com/自動生成的反應原生項目。現在,我在添加react-native-lock與反應本地鏈接後收到這些構建錯誤。它的工作原理罰款和Xcode在iOS項目,但Android的工作室給我這個錯誤:錯誤:包名稱爲'com.facebook.react'的多個庫

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:[email protected]') { 
    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 
} 
(':react-native-lock')
+0

發佈您的'build.gradle'文件。 –

+0

ok - 已添加文件 – MonkeyBonkey

回答

相關問題