React-native-firebase: firebase with code push integration

Created on 7 May 2019  路  13Comments  路  Source: invertase/react-native-firebase

For feature requests please visit our Feature Request Board.

Most helpful comment

Changing versions in build.gradle didn't help me. What did work adding the line:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
in android/app/build.gradle
At the very bottom of file, after apply plugin: 'com.google.gms.google-services'

All 13 comments

@CruGlobal

I am having this issue. I ams using react-native:0.57.8, react-native-firbase:5.3.1, here is my build.gradle files.

Task :react-native-code-push:compileDebugAidl FAILED
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.nimbusds, artifactId=n
imbus-jose-jwt, version=5.1), toArtifact=Artifact(groupId=net.minidev, artifactId=json-smart), toArtifactVersionString=[1.3.1,2.3
])

FAILURE: Build failed with an exception.

  • What went wrong:
    Failed to capture fingerprint of input files for task ':react-native-code-push:compileDebugAidl' property 'importDirs' during up-
    to-date check.

    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.1 -> 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.nimbusds:[email protected]

    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.

project level build.gradle files.

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

buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}

app/build.gradle file.

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "demo.js"
]

apply from: "../../node_modules/react-native/react.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

/**

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

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
    applicationId "com.paciolan.sdkapp"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
    }
}
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
        }
    }
}
buildTypes {
    release {
        minifyEnabled true
        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 {
implementation project(':react-native-firebase')
implementation project(':react-native-code-push')
implementation project(':react-native-i18n')
// compile project(':react-native-localization')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.8"
}

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

let me know please what is wrong here..

there are other bugs related to this I believe - something about the strict version checker for google play going haywire when combined with ranges, it checks for the exact string that is the range, instead of the values in between it. Probably have to disable the android compatibility version checker - search around for related issues in this tracker

I got resolved mine. I have followed react-native-firebase starter. And i made a changes on build.gradle file
FROM
ext{
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}

TO

ext {
buildToolsVersion = "27.0.0"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 26
supportLibVersion = "28.0.0"
}.

And it solved.

That is unexpected and not a great thing though. Can you confirm toggling just that setting - buildToolsVersion - between 27 and 28 causes it to break or to work, respectively?

I confirm. By changing to targetSdkVersion = 26, buildToolsVersion = "28.0.3. I have checked all other scenarios. But this is the culprit.

That is so strange. Thank you very much for double-checking - this issue hits a lot of people (and I'm about to integrate code-push myself!) so knowing all the little ins and outs of it is useful

Changing versions in build.gradle didn't help me. What did work adding the line:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
in android/app/build.gradle
At the very bottom of file, after apply plugin: 'com.google.gms.google-services'

this is the true solution
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Changing versions in build.gradle didn't help me. What did work adding the line:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
in android/app/build.gradle
At the very bottom of file, after apply plugin: 'com.google.gms.google-services'

This dosen't work for me as it says cant find plugin com.google.gms.google-services

Failed to apply plugin [id 'com.google.gms.google-services']
Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

@mikehardy Tried that. Got this.

No such property: config for class: com.google.gms.googleservices.GoogleServicesPlugin

@gravyplaya open new issue following template, not enough info from your brief comments on this closed issue, sorry

its very simple just update your com.google.gms services

com.google.gms:google-services:4.3.2
to
com.google.gms:google-services:4.3.3

Was this page helpful?
0 / 5 - 0 ratings