繁体   English   中英

反应本机:BeoNews应用程序运行Android执行任务':app:transformClassesWithJarMergingForDebug'失败

[英]React-native: BeoNews app run-android Execution failed for task ':app:transformClassesWithJarMergingForDebug'

我正在按照以下步骤操作: https : //beonews.inspireui.com/beonews-setup.html

当尝试运行react-native run-android

出现错误:

:app:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* 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/internal/zzatb.class

根build.gradle:

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

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.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
    }
}
project(':react-native-fbsdk') {
  configurations.all {
    resolutionStrategy {
      force 'com.facebook.android:facebook-android-sdk:4.22.1'
    }
  }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        configurations.all {
            resolutionStrategy {
              force 'com.facebook.android:facebook-android-sdk:4.22.1'
            }
        }
    }
}

应用程序build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"


def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.beonews"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 10
    versionName "2.4"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    manifestPlaceholders = [onesignal_app_id: "85cbc2b5-4e0d-4214-9653-8054d06f4256",
                            onesignal_google_project_number: "REMOTE"]


    // Enabling multidex support.
    multiDexEnabled true
}
signingConfigs {
    release {
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            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-google-analytics-bridge')
compile project(':react-native-admob')
compile project(':react-native-onesignal')
compile project(':react-native-google-signin')
compile project(':react-native-fbsdk')
compile project(':react-native-blur')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')

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 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:facebook-android-sdk:[4.22.1)'


//compile 'com.android.support:multidex:1.0.1'
compile(project(":react-native-google-signin")){
    exclude group: "com.google.android.gms" // very important
}
compile "com.google.android.gms:play-services-auth:10.2.6"  // should be at least 9.0.0

compile "com.google.android.gms:play-services-base:10.2.6"
compile "com.google.android.gms:play-services-location:10.2.6"
compile "com.google.android.gms:play-services-ads:10.2.6"
}
apply plugin: 'com.google.gms.google-services'


// 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'
}

Windows10。尝试:

  • 使用Android Studio和简单的cmd命令以及PhpStorm。
  • 更改google pkgs版本
  • 运行gradlew clean (顺便说一句,构建成功,但之后仍无法使用run-android
  • 删除google pkgs并添加compile firebase作为单独的一个

我该如何解决?

尝试将此行更新为版本11.0.0

compile "com.google.android.gms:play-services-auth:10.2.6"  // should be at least 9.0.0

compile "com.google.android.gms:play-services-base:10.2.6"
compile "com.google.android.gms:play-services-location:10.2.6"
compile "com.google.android.gms:play-services-ads:10.2.6"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM