Получение ошибки во время интеграцииact-native-firebase для Android для моего проекта - PullRequest
1 голос
/ 21 июня 2019

Ниже приведена полная ошибка:

FAILURE: Build failed with an exception.
 What went wrong: Execution failed for task ':react-native-azure-adal:javaPreCompileDebug'. > In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.3.1 ,2.3]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

    Dependency failing: com.nimbusds:nimbus-jose-jwt:5.7 -> net.minidev:json-smart@[1.3.1,2.3], but json-smart version was 2 .3.

    The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue. -- Project 'app' depends on project 'react' which depends onto com.microsoft.aad:adal@1.15.+ -- Project 'app' depends on project 'react' which depends onto com.microsoft.identity:common@{strictly 0.0.4} -- Project 'app' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt@{strictly 5.7} -- Project 'app' depends on project 'react' which depends onto net.minidev:json-smart@{strictly 2.3} -- Project 'app' depends on project 'react' which depends onto com.microsoft.aad:adal@{strictly 1.15.1}

    For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:// github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b uild.gradle file.

    Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    Get more help at https://help.gradle.org

    Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

    BUILD FAILED in 44s 88 actionable tasks: 88 executed error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

Я выполнил действия, указанные в этой ссылке

https://rnfirebase.io/docs/v5.x.x/installation/android#Update-Google-Play-service-maven-repository.

Мой файл applevel build.gradle имеет видниже:

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
googlePlayServicesVersion = '16.0.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}

Мой android / app / build.gradle

    apply plugin: "com.android.application"

    import com.android.build.OutputFile
    import groovy.json.JsonSlurper
    /**

    The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
    and bundleReleaseJsAndAssets).
    These basically call react-native bundle with the correct arguments during the Android build
    cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
    bundle directly from the development server. Below you can see all the possible configurations
    and their defaults. If you decide to add a configuration block, make sure to add it before the
    apply from: "../../node_modules/react-native/react.gradle" line.
    project.ext.react = [
    // the name of the generated asset file containing your JS bundle
    bundleAssetName: "index.android.bundle",
    // the entry file for bundle generation
    entryFile: "index.android.js",
    // whether to bundle JS and assets in debug mode
    bundleInDebug: false,
    // whether to bundle JS and assets in release mode
    bundleInRelease: true,
    // whether to bundle JS and assets in another build variant (if configured).
    // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
    project.ext.react = [
    entryFile: "index.js"
    ]

    apply from: "../../node_modules/react-native/react.gradle"
    apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
    apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

    /**

    Set this to true to create two separate APKs instead of one:
    An APK that only works on ARM devices
    An APK that only works on x86 devices
    The advantage is the size of the APK is reduced by about 4MB.
    Upload all the APKs to the Play Store and people will download
    the correct one based on the CPU architecture of their device.
    */
    def enableSeparateBuildPerCPUArchitecture = false
    /**

    Read versionCode abd versionName
    */
    def getVersionCode() {
    def inputFile = new File("../packaging/build_scripts/androidVersionInfo.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)
    return packageJson["versionCode"]
    }
    def getVersionName() {
    def inputFile = new File("../packaging/build_scripts/androidVersionInfo.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)
    return packageJson["versionName"]
    }

    def buildVersionCodeVer = getVersionCode()
    def buildVersionNameVer = getVersionName()



 1. /**

        Run Proguard to shrink the Java bytecode in release builds.
        */
        def enableProguardInReleaseBuilds = false
        android {
        compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    dependencies {
    implementation project(':react-native-firebase')
    implementation project(':react-native-android-open-settings')
    implementation project(':react-native-svg')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-splash-screen')
    implementation project(':@react-native-community_blur')
    implementation(project(':react-native-geolocation-service')) {
    exclude group: 'com.google.android.gms', module: 'play-services-location'
    }
    implementation "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
    implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-code-push')
    implementation project(':react-native-device-info')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-version-number')
    implementation project(':appcenter-crashes')
    implementation project(':react-native-gesture-handler')
    implementation project(':appcenter-analytics')
    implementation project(':appcenter')
    implementation project(':react-native-azure-adal')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+" // From node_$googlePlayServicesVersionmodule
    implementation "com.google.firebase:firebase-core:16.0.9"
    }

    // 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'
    }
    apply plugin: 'com.google.gms.google-services'
  1. Когда я понижаю версию classpath до com.google.gms: google-службах до 4.0.1, вышеуказанная ошибка устранена, но она выдает эту ошибку.
 - The library com.google.android.gms:play-services-measurement-base is
   being requested by various other libraries at [[15.0.4,15.0.4]], but
   resolves to 16.5.0. Disable the plugin and check your dependencies
   tree using ./gradlew :app:dependencies. > The library
   com.google.firebase:firebase-analytics is being requested by various
   other libraries at [[16.0.0,16.0.0]], but resolves to 16.5.0. Disable
   the plugin and check your dependencies tree using ./gradlew
   :app:dependencies.
...