React-native-firebase: Adding a new dependency displays error

Created on 14 Apr 2018  Â·  2Comments  Â·  Source: invertase/react-native-firebase

Adding a new dependency displays the error below:

04-14 15:35:39.927 7202-7202/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
04-14 15:35:39.969 7202-7209/? E/zygote: Failed sending reply to debugger: Broken pipe
04-14 15:35:39.970 7202-7209/? I/zygote: Debugger is no longer active
04-14 15:35:40.386 7202-7202/? D/AndroidRuntime: Shutting down VM
04-14 15:35:40.397 7202-7202/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.test, PID: 7202
                                                 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
                                                     at com.google.firebase.perf.provider.FirebasePerfProvider.attachInfo(Unknown Source:2)
                                                     at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
                                                     at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
                                                     at android.app.ActivityThread.-wrap1(Unknown Source:0)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
                                                     at android.os.Handler.dispatchMessage(Handler.java:105)
                                                     at android.os.Looper.loop(Looper.java:164)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/base.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_resources_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/lib/x86, /system/fake-libs, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/base.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_resources_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.test-Uywtx3-GCZBF2P3aFpfMwQ==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
                                                            ... 8 more

settings.gradle

rootProject.name = ‘test’
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')

include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':app'`

build.gradle (project)

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

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

build.gradle (app)

apply plugin: "com.android.application"

import com.android.build.OutputFile

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

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

def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
    dexOptions {
        javaMaxHeapSize "4g"
    }
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.test"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk { abiFilters "armeabi-v7a", "x86" }
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) { 
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation(project(':react-native-firebase')) {
        transitive = false
    }

    implementation "com.google.firebase:firebase-core:12.0.1"
    implementation "com.google.android.gms:play-services-base:12.0.1"

    implementation "com.google.firebase:firebase-database:12.0.1"
    implementation project(':react-native-device-info')     // <==== NEW DEPENDENCY

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.0.2"
    implementation "com.facebook.react:react-native:+"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

if removing dependency works
implementation project(':react-native-device-info')

erro

Please tell what I'm doing wrong here! Why can not I add another dependency?

Build Error Android User Issue Perf

Most helpful comment

@andcosta change all imports like these

    implementation "com.google.firebase:firebase-core:12.0.1
    implementation "com.google.android.gms:play-services-base:12.0.1
    implementation "com.google.firebase:firebase-database:12.0.1

to 15.0.0 and classpath 'com.android.tools.build:gradle:3.1.1' This solved it for me, issue is not related to rnfirebase.

All 2 comments

@andcosta change all imports like these

    implementation "com.google.firebase:firebase-core:12.0.1
    implementation "com.google.android.gms:play-services-base:12.0.1
    implementation "com.google.firebase:firebase-database:12.0.1

to 15.0.0 and classpath 'com.android.tools.build:gradle:3.1.1' This solved it for me, issue is not related to rnfirebase.

thank you @IljaDaderko

Was this page helpful?
0 / 5 - 0 ratings