2017-09-25 62 views
0

你好,我看過的人相似的帖子用同樣的問題,但我不能確定鎖定。我正在使用反應本機,我已經清理了我的項目。這是我得到的錯誤,我不知道還有什麼我應該嘗試?我收到了有關NKD平臺的警告,但我目前還不確定。陣營本地執行失敗的任務「:應用程序:transformClassesWithJarMergingForDebug」

* What went wrong: 
Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzf.class 

機器人/應用/的build.gradle

apply plugin: "com.android.application" 
apply plugin: 'com.google.gms.google-services' 

import com.android.build.OutputFile 

apply from: "../../node_modules/react-native/react.gradle" 
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" 
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" 
def enableSeparateBuildPerCPUArchitecture = false 
def enableProguardInReleaseBuilds = false 

android { 
    compileSdkVersion 23 
    buildToolsVersion '25.0.0' 

    defaultConfig { 
     applicationId "com.art.android" 
     minSdkVersion 16 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
signingConfigs { 
     release { 
      storeFile file(MYAPP_RELEASE_STORE_FILE) 
      storePassword MYAPP_RELEASE_STORE_PASSWORD 
      keyAlias MYAPP_RELEASE_KEY_ALIAS 
      keyPassword MYAPP_RELEASE_KEY_PASSWORD 
     } 
    } 
    splits { 
     abi { 
      reset() 
      enable enableSeparateBuildPerCPUArchitecture 
      universalApk false // If true, also generate a universal APK 
      include "armeabi-v7a", "x86" 
     } 
    } 
    buildTypes { 
     release { 
      minifyEnabled enableProguardInReleaseBuilds 
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 
      signingConfig signingConfigs.release 
     } 
    } 
    // applicationVariants are e.g. debug, release 
    applicationVariants.all { variant -> 
     variant.outputs.each { output -> 
      // For each separate APK per architecture, set a unique version code as described here: 
      // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 
      def versionCodes = ["armeabi-v7a":1, "x86":2] 
      def abi = output.getFilter(OutputFile.ABI) 
      if (abi != null) { // null for the universal-debug, universal-release variants 
       output.versionCodeOverride = 
         versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 
      } 
     } 
    } 
} 

dependencies { 
    compile project(':react-native-vector-icons') 
    compile project(':react-native-fcm') 
    compile project(':react-native-code-push') 
    compile project(':tipsi-stripe') 
    compile project(':react-native-splash-screen') 
    compile project(':react-native-image-resizer') 
    compile project(':react-native-image-picker') 
    compile project(':react-native-fetch-blob') 
    compile project(':react-native-camera') 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile fileTree(dir: "libs", include: ["*.jar"]) 
    compile "com.android.support:appcompat-v7:23.0.1" 
    compile "com.facebook.react:react-native:+" // From node_modules 
} 

// Run this once to be able to run the application with BUCK 
// puts all compile dependencies into folder libs for BUCK to use 
task copyDownloadableDepsToLibs(type: Copy) { 
    from configurations.compile 
    into 'libs' 
} 

機器人/的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     // Add jitpack repository (added by tipsi-stripe) 
     maven { url "https://jitpack.io" } 
     mavenLocal() 
     jcenter() 
     maven { 
      // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 
      url "$rootDir/../node_modules/react-native/android" 
     } 
    } 
} 

更新1:添加的package.json

"dependencies": { 
    "analytics-react-native": "^1.1.0", 
    "axios": "^0.16.2", 
    "babel-plugin-transform-decorators-legacy": "^1.3.4", 
    "babel-preset-es2015": "^6.24.1", 
    "babel-preset-react": "^6.24.1", 
    "bluebird": "^3.5.0", 
    "buffer": "^5.0.6", 
    "eslint": "^4.1.1", 
    "eslint-plugin-react": "^7.1.0", 
    "events": "^1.1.1", 
    "fbemitter": "^2.1.1", 
    "firebase": "^4.0.0", 
    "firebase-admin": "^5.0.0", 
    "firebase-functions": "^0.5.8", 
    "lodash": "^4.17.4", 
    "md5": "^2.2.1", 
    "prop-types": "^15.5.10", 
    "react": "16.0.0-alpha.6", 
    "react-native": "^0.44.0", 
    "react-native-camera": "^0.9.0", 
    "react-native-code-push": "2.1.1-beta", 
    "react-native-elements": "^0.17.0", 
    "react-native-fcm": "^9.1.0", 
    "react-native-fetch-blob": "^0.10.5", 
    "react-native-gifted-chat": "^0.1.4", 
    "react-native-icon-badge": "^1.1.3", 
    "react-native-image-picker": "^0.26.3", 
    "react-native-image-resizer": "^0.1.0", 
    "react-native-keyboard-aware-scroll-view": "^0.2.9", 
    "react-native-offline": "^3.1.0", 
    "react-native-qrcode": "^0.2.3", 
    "react-native-splash-screen": "^3.0.0", 
    "react-native-swiper": "^1.5.4", 
    "react-native-vector-icons": "^4.4.0", 
    "react-navigation": "^1.0.0-beta.11", 
    "react-redux": "^4.4.5", 
    "react-router": "^2.5.1", 
    "redux": "^3.6.0", 
    "redux-observable": "^0.14.1", 
    "redux-persist": "^4.0.0-alpha5", 
    "redux-thunk": "^2.1.0", 
    "source-map": "^0.5.6", 
    "stripe": "^4.23.1", 
    "tipsi-stripe": "^3.2.0", 
    "twilio-chat": "^1.0.3", 
    "twilio-common": "^0.1.6", 
    "util": "^0.10.3" 
    }, 

更新2所述的問題是由我需要添加的tipsi-stripe引起的

compile(project(':tipsi-stripe')){ 
    exclude group: 'com.google.android.gms' 
} 

compile ('com.google.android.gms:play-services-wallet:10.0.1'){ 
force=true 
} 
+0

檢查這裏的表適用於Firebase的Android SDK版本。 https://github.com/invertase/react-native-firebase#supported-versions---react-native--firebase –

回答

0

的問題是在這個火力點版本編譯

compile 'com.google.firebase:firebase-core:10.0.1' 

它應該是一樣什麼是

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

編譯,因爲它也依賴於火力來修復添加

compile ('com.google.firebase:firebase-core:10.0.1'){ 
    force=true 
} 
compile ('com.google.firebase:firebase-messaging:10.0.1'){ 
    force=true 
} 
compile ('com.google.android.gms:play-services-base:10.0.1'){ 
    force=true 
} 
+0

我加了 compileSdkVersion 25 buildToolsVersion '25.0.0',因爲一個庫需要它,但我'米仍然得到相同的錯誤。還有其他建議嗎? – jaysig

+0

需要它通過使用圖書館嗎? –

+0

我知道這個問題。你知道你能請添加您的package.json –

相關問題