react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/auth/internal/InternalAuthProvider;

Open snamstorm opened this issue 7 years ago • 38 comments

Recently added a few google packages such as Crashlytics and updated google-services for Google-Signin on firebase. Since then, Android build is successful through both Android Studio build and react-native run-android. Before these changes app launched without any issue,

App is uploaded to emulator successfully however, app won't launch

The only error log I get is from logcat which seems to be related to firebase auth

2019-05-08 13:47:11.641 15444-15444/com.xxxxxx E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.xxxxxxx, PID: 15444
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/auth/internal/InternalAuthProvider;
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-common@@17.0.0:78)
        at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-common@@17.0.0:71)
        at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@17.0.0:468)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:354)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:321)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:305)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.0.0:53)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.0.0:47)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: com.google.firebase.auth.internal.InternalAuthProvider
        at java.lang.VMClassLoader.findLoadedClass(Native Method)
        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-common@@17.0.0:78) 
        at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-common@@17.0.0:71) 
        at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@17.0.0:468) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:354) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:321) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:305) 
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.0.0:53) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.0.0:47) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:6391) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/internal/InternalTokenProvider;
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-common@@17.0.0:78) 
        at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-common@@17.0.0:71) 
        at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@17.0.0:468) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:354) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:321) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:305) 
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.0.0:53) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.0.0:47) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:6391) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.internal.InternalTokenProvider" on path: DexPathList[[zip file "/data/app/com.xxxxxxx-9_NR07rkrD3jKgN-0U3DBQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.xxxxxxx-9_NR07rkrD3jKgN-0U3DBQ==/lib/x86, /data/app/com.xxxxxxx-9_NR07rkrD3jNgN-0U3DBQ==/base.apk!/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

Project Files

Android

android/build.gradle:

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
	googlePlayServicesAuthVersion = "16.0.1" // for social signin with firebase
    }
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1' // 3.2.1 3.1.4
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        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"
        }
        maven {
            url "https://maven.google.com"
        }
    }
}

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

subprojects {
   project.configurations.all {
       resolutionStrategy.eachDependency { details ->
           if (details.requested.group == 'com.android.support'
                   && !details.requested.name.contains('multidex') ) {
               details.useVersion "26.1.0"
           }
       }
   }
}

android/app/build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

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

    bundleInDebug: false,
    bundleInRelease: true,

    bundleDevDebug: false,
    bundleUatDebug: true,
    bundleProdDebug: true,
    bundleDevRelease: false,
    bundleUatRelease: true,
    bundleProdRelease: true,

    devDisabledInDebug: false,
    devDisabledInRelease: true,

    devDisabledInDevDebug: false,
    devDisabledInUatDebug: false,
    devDisabledInProdDebug: false,
    devDisabledInDevRelease: true,
    devDisabledInUatRelease: true,
    devDisabledInProdRelease: true,

    jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
    jsBundleDirRelease: "$buildDir/intermediates/assets/release",

    resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
    resourcesDirRelease: "$buildDir/intermediates/res/merged/release",

    inputExcludes: ["android/**", "ios/**", "__tests__/**", "js_build/**"]
]

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

def enableProguardInReleaseBuilds = false

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    flavorDimensions "default"  // <-- !!! add this line for multiple variants!!!

    defaultConfig {
        applicationId "xxxxxxx"
        resValue "string", "build_config_package", "xxxxxx"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        // versionCode 1 <- added to AndroidManifest.xml for CI
        // versionName "1.0" 1 <- added to AndroidManifest.xml for CI
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        multiDexEnabled true

        vectorDrawables.useSupportLibrary = true // for react-native-image-crop-picker
    }

    signingConfigs {

    }

    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"
            signingConfig signingConfigs.release
            debuggable false
        }
    }

    productFlavors {
        dev {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId 'xxxxxxx'
            targetSdkVersion rootProject.ext.targetSdkVersion
            resValue "string", "build_config_package", "xxxxxx"
        }
        uat {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId 'xxxxxxx'
            targetSdkVersion rootProject.ext.targetSdkVersion
            resValue "string", "build_config_package", "xxxxxx"
        }
        prod {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId 'xxxxxx'
            targetSdkVersion rootProject.ext.targetSdkVersion
            resValue "string", "build_config_package", "xxxxx"
        }
    }

    // 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, "arm64-v8a": 3, "x86_64": 4]
            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
            }
        }
    }

    dexOptions {
        preDexLibraries false
        javaMaxHeapSize "8g" // this to speed up the builds
    }
}

dependencies {
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-webview')
    implementation project(':react-native-svg')
    implementation project(':@react-native-community_netinfo')
    implementation project(':react-native-google-signin')
    implementation project(':react-native-fbsdk')
    implementation project(':@react-native-community_slider')
    implementation project(':react-native-android-open-settings')
    implementation project(':react-native-localize')
    implementation project(':react-native-fs')
    implementation project(':react-native-camera')
    implementation project(':react-native-video')
    implementation project(':react-native-youtube')
    implementation project(':react-native-firebase')
    implementation project(':react-native-uuid-generator')
    implementation project(':react-native-device-info')
    implementation project(':react-native-fast-image')
    implementation project(':react-native-contacts')
    implementation project(':react-native-screens')
    implementation project(':react-native-share-extension')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-push-notification')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-spinkit')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-share')
    //implementation project(':react-native-geolocation-service')
    implementation(project(':react-native-geolocation-service')) {
        exclude group: 'com.google.android.gms', module: 'play-services-location'
    }
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation 'com.facebook.react:react-native:+'
    // From node_modules
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    // <-- Add this line if you wish to use badge on Android
    implementation 'com.google.android.gms:play-services-base:16.0.1'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.google.firebase:firebase-invites:16.0.6'
    implementation 'com.google.firebase:firebase-dynamic-links:16.0.6'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
	implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true;
    }

	implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
    implementation project(':react-native-fbsdk')
}

// 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'
apply plugin: 'io.fabric'

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true // this disables some warning about firebase incompatible versions etc

android/settings.gradle:

rootProject.name = 'xxxxxxx'
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
include ':@react-native-community_netinfo'
project(':@react-native-community_netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android')
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')
include ':@react-native-community_slider'
project(':@react-native-community_slider').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/slider/android')
include ':react-native-android-open-settings'
project(':react-native-android-open-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-open-settings/android')
include ':react-native-localize'
project(':react-native-localize').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localize/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':react-native-youtube'
project(':react-native-youtube').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-youtube/android')
include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-uuid-generator'
project(':react-native-uuid-generator').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uuid-generator/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-share-extension'
project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':react-native-screens'
project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
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-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-spinkit'
project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-uuid-generator'
project(':react-native-uuid-generator').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uuid-generator/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-share-extension'
project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':react-native-screens'
project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
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-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-spinkit'
project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-uuid-generator'
project(':react-native-uuid-generator').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uuid-generator/android')
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-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-screens'
project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android')
include ':react-native-share-extension'
project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-spinkit'
project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':react-native-geolocation-service'
project(':react-native-geolocation-service').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-geolocation-service/android')
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')

include ':app'

MainApplication.java:

package com.xxxxxx;

import android.app.Application;

import com.BV.LinearGradient.LinearGradientPackage;
import com.alinz.parkerdan.shareextension.SharePackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.facebook.CallbackManager;
import com.facebook.react.ReactApplication;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.horcrux.svg.SvgPackage;
import com.reactnativecommunity.netinfo.NetInfoPackage;
///import com.goldenowl.twittersignin.TwitterSigninPackage;
import co.apptailor.googlesignin.RNGoogleSigninPackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.CallbackManager;
import com.reactnativecommunity.slider.ReactSliderPackage;
import com.levelasquez.androidopensettings.AndroidOpenSettingsPackage;
import com.reactcommunity.rnlocalize.RNLocalizePackage;
import com.rnfs.RNFSPackage;
import org.reactnative.camera.RNCameraPackage;
import com.inprogress.reactnativeyoutube.ReactNativeYouTube;
//import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.brentvatne.react.ReactVideoPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import io.github.traviskn.rnuuidgenerator.RNUUIDGeneratorPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.alinz.parkerdan.shareextension.SharePackage;
import cl.json.RNSharePackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.imagepicker.ImagePickerPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import io.invertase.firebase.RNFirebasePackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.BV.LinearGradient.LinearGradientPackage;
import com.react.rnspinkit.RNSpinkitPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import io.github.traviskn.rnuuidgenerator.RNUUIDGeneratorPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.alinz.parkerdan.shareextension.SharePackage;
import cl.json.RNSharePackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.imagepicker.ImagePickerPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import io.invertase.firebase.RNFirebasePackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.BV.LinearGradient.LinearGradientPackage;
import com.react.rnspinkit.RNSpinkitPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.imagepicker.ImagePickerPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.oblador.vectoricons.VectorIconsPackage;
import com.react.rnspinkit.RNSpinkitPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.swmansion.rnscreens.RNScreensPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import java.util.Arrays;
import java.util.List;
import cl.json.RNSharePackage;
import io.github.traviskn.rnuuidgenerator.RNUUIDGeneratorPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.invertase.firebase.links.RNFirebaseLinksPackage;
import com.agontuk.RNFusedLocation.RNFusedLocationPackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;


public class MainApplication extends Application implements ReactApplication {
	private static CallbackManager mCallbackManager = CallbackManager.Factory.create();

	protected static CallbackManager getCallbackManager() {
	  return mCallbackManager;
	}

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new PickerPackage(),
            new RNCWebViewPackage(),
            new SvgPackage(),
            new NetInfoPackage(),
            ///new TwitterSigninPackage(),
            new RNGoogleSigninPackage(),
            new ReactSliderPackage(),
            new AndroidOpenSettingsPackage(),
            new RNLocalizePackage(),
            new RNFSPackage(),
            new RNCameraPackage(),
            new ReactNativeYouTube(),
            //new ReactNativeConfigPackage(),
            new ReactVideoPackage(),
            new VectorIconsPackage(),
            new RNUUIDGeneratorPackage(),
            new SplashScreenReactPackage(),
            new SharePackage(),
            new RNSharePackage(),
            new RNScreensPackage(),
            new ReactNativePushNotificationPackage(),
            new ImagePickerPackage(),
            new RNGestureHandlerPackage(),
            new RNFirebasePackage(),
            new FastImageViewPackage(),
            new RNDeviceInfo(),
            new ReactNativeContacts(),
            new LinearGradientPackage(),
            new RNSpinkitPackage(),
            new RNFirebaseMessagingPackage(), // <-- Add this line
            new RNFirebaseNotificationsPackage(), // <-- this is for notifs-only or notifs-with-data ( so not data-only )
            new RNFirebaseAuthPackage(), // for phone authentication
            new RNFusedLocationPackage(),
            new RNFirebaseLinksPackage(),
			new RNFirebaseStoragePackage(),
			new FBSDKPackage(mCallbackManager)
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xxxxxx"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

    <!-- from react native notif permissions -->
    <!-- < Only if you're using GCM or localNotificationSchedule() > -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <permission
        android:name="${applicationId}.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
    <!-- < Only if you're using GCM or localNotificationSchedule() > -->

    <!-- used by firebase and others for notifications -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.front" android:required="false" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:usesCleartextTraffic="true">

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:launchMode="singleTop"
        android:screenOrientation="portrait">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:host="xxxxx.page.link" android:scheme="http"/>
            <data android:host="xxxxx.page.link" android:scheme="https"/>
        </intent-filter>

      </activity>

      
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

      <!-- for react-native-share-extension -->
      <activity
            android:noHistory="true"
            android:name=".share.ShareActivity"
            android:configChanges="orientation"
            android:label="@string/title_activity_share"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Share.Transparent"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
                <data android:mimeType="image/*" />
            </intent-filter>
      </activity>

    <!-- from crashlytics -->
    <meta-data android:name="io.fabric.ApiKey" android:value="xxxxxxx"/>

    <!-- from react native notif permissions -->
    <meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name" android:value="YOUR NOTIFICATION CHANNEL NAME"/>
    <meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
    <!-- Change the resource name to your App's accent color - or any other color you want -->
    <meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@android:color/white"/>

    <!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
        See README(https://goo.gl/l4GJaQ) for more. -->
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_ic_notification" />
    <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
                notification message. See README(https://goo.gl/6BKBk7) for more. -->
    <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
    <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/>

	<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
	
        <!-- firebase to schedule local notifs -->
        <receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
        <receiver android:enabled="true" android:exported="true"  android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
                <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>



        <!-- < Only if you're using GCM or localNotificationSchedule() > -->
        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="${applicationId}" />
            </intent-filter>
        </receiver>
        <!-- < Only if you're using GCM or localNotificationSchedule() > -->
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>

        <!-- < Only if you're using GCM or localNotificationSchedule() > -->
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        <!-- </ Only if you're using GCM or localNotificationSchedule() > -->

        <!-- < Else > -->
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <!-- </Else> -->

        <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>


    </application>

</manifest>


Environment

react-native info output:

React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
      Memory: 19.28 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.2.0 - /usr/local/bin/node
      npm: 6.7.0 - ~/.npm-packages/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 26, 28
        Build Tools: 28.0.3, 29.0.0
        System Images: android-26 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.4 => 16.8.4 
      react-native: ^0.59.1 => 0.59.1 
    npmGlobalPackages:
      react-native-cli: 2.0.1
  • Platform that you're experiencing the issue on:

    • [X] Android
  • Are you using TypeScript?

    • N

snamstorm avatar May 08 '19 05:05 snamstorm

I have same issue on android.

deflorilemarului avatar May 08 '19 10:05 deflorilemarului

I have same issue on android.

Please check this link. https://firebase.google.com/support/release-notes/android

minion0324 avatar May 08 '19 11:05 minion0324

with com.google.firebase:firebase-auth:17.0.0 runs without crashes

igor-slotin avatar May 08 '19 12:05 igor-slotin

@igor-slotin Please let me know your react-native and react-native-firebase version. And did you change only com.google.firebase:firebase-auth:17.0.0? Or any others? (I mean firebase-core and etc)

minion0324 avatar May 08 '19 12:05 minion0324

current react-native-firbase version is 4.3.7 I've downgraded it from 4.3.8, will try to turn it back now yes, changed only firbase-auth.

igor-slotin avatar May 08 '19 12:05 igor-slotin

Looks like this is the latest Android SDK release causing this - I'm not sure why the latest release is causing issues when the versions are locked in your dependencies to versions that were working prior to yesterdays release =/

If @igor-slotin solution works then that's the way to go, update to latest Auth SDK:

 com.google.firebase:firebase-auth:17.0.0

Alternatively, it may just be that only core is required to be updated here instead of auth, could someone try that and confirm here please, update core from 16.0.8 to 16.0.9:

com.google.firebase:firebase-core:16.0.9

Salakar avatar May 08 '19 13:05 Salakar

I've also update com.google.firebase:firebase-core from 16.0.8 to 16.0.9 com.google.firebase:firebase-database to 17.0.0 com.google.firebase:firebase-storage to 17.0.0 app has been runned sucessfly, curently in the process of testing functionality

@Salakar you suggestion make sense, i can try update just only it in 10 minutes

igor-slotin avatar May 08 '19 13:05 igor-slotin

I got this same crash on Monday night UK time, 6th May 2019. Was doing debug builds (just superficial tweaks to our codebase), running them on Android emulator, all was fine, then suddenly this error and no builds working since. Another coder on our team just got it this morning.

React Native 0.56.1

*Project gradle*
Android gradle plugin com.android.tools.build:gradle:3.1.4 (Gradle 4.4)
com.google.gms:google-services:4.0.1

*App gradle*
com.google.android.gms:play-services-base:16.0.1
com.google.firebase:firebase-core:16.0.4
com.google.firebase:firebase-auth:16.0.5

*package.json*
[email protected]

Might be relevant: To overcome a previous gradle bomb we have this in our app gradle...

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

chichilatte avatar May 08 '19 13:05 chichilatte

Nope, updating just core doesn't work for me, the same crash

igor-slotin avatar May 08 '19 13:05 igor-slotin

UPDATE: I got it working by updating firebase-auth to 17.0.0 as mentioned above :) Also updated the others while i was at it...

*Project gradle*
com.google.gms:google-services:4.1.0
(tried 4.2.0 but it gave me a build error)

*App gradle*
com.google.android.gms:play-services-base:16.1.0
com.google.firebase:firebase-core:16.0.9
com.google.firebase:firebase-auth:17.0.0

What i would love to know is: How did this bug happen without me doing anything apart from running react-native run-android? All the relevant dependencies have specific versions. Hmm.

chichilatte avatar May 08 '19 14:05 chichilatte

I also am facing same issue. Has anyone resolved yet? I have not installed any new packages but still my app crashes with same error

ericm999 avatar May 08 '19 14:05 ericm999

What i would love to know is: How did this bug happen without me doing anything apart from running react-native run-android? All the relevant dependencies have specific versions. Hmm.

An Android Firebase SDK release must have caused this, very weird though given that all of us, myself included have specified the exact versions - but according to the Firebase Android SDK release notes for yesterday there was a breaking Auth change:

image

Must have been backported or something, really don't know 🤷‍♂

Salakar avatar May 08 '19 15:05 Salakar

@ericm999 It seems that an android SDK update has broken the existing packages. However, updating firebase-core from 16.0.8 to 16.0.9 and all other firebase-* packages from 16.x to 17.0.0 has fixed the issues for me (and otherwise seems to work fine).

nicoburns avatar May 08 '19 16:05 nicoburns

with com.google.firebase:firebase-auth:17.0.0 runs without crashes

Thank you all, upgrading firebase-auth to 17.0.0 fixed the issue.

snamstorm avatar May 09 '19 01:05 snamstorm

with com.google.firebase:firebase-auth:17.0.0 runs without crashes

Thanks man you saved my day !!!

AarshOza avatar May 09 '19 06:05 AarshOza

A heads up as well if you're using storage: if you're getting unknown http failure errors, check the logs, if you see the following then you'll need to update to the latest Android SDK version for that as well 😫

java.lang.NoSuchMethodError: No virtual method getToken(Z)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.invertase.testing-liclx4O0EGs09L4RDd7guA==/base.apk!classes3.dex)

image


It may be the case on other modules, the safest option is to update all of them. There are no breaking changes as far as I can see that will affect RNFB v5 (have tested on RNFB v6 - which had same versions as RNFB v5)

image

Salakar avatar May 09 '19 23:05 Salakar

I am using current everything on the android side (current gradle, current gradle plugin, current sdk, build tools, firebase deps etc etc) with react-native-firebase 5.3.1 and it's fine for all the modules I'm using - I am not using storage, remote config, or dynamic links yet though

mikehardy avatar May 10 '19 02:05 mikehardy

@mikehardy not sure why it works for you :D Happened to me today on v6 without upgrading anything, just did a fresh android build and it went spoopy 💩

Salakar avatar May 10 '19 03:05 Salakar

Well, I have something to look forward to on my next build then I suppose - the joy of dynamic dependency resolution.

mikehardy avatar May 10 '19 03:05 mikehardy

Anyone who gets module specific errors like Auth,Database, etc. Try updating those to 17.0.0. As firebase updated to these SDK version. Somehow the older SDKs version broke and couldn't simply work anymore !!

AarshOza avatar May 10 '19 07:05 AarshOza