invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.75k stars 2.21k forks source link

Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp(Context) first #360

Closed arminsal1 closed 7 years ago

arminsal1 commented 7 years ago

This error happens immediately whenever I run the android version of my project. iOS has no issues. I know V3 is coming and should do away with this altogether, but I'd like to resolve this as soon as possible.

screen shot 2017-08-25 at 10 01 57 pm screen shot 2017-08-25 at 10 02 06 pm

build.gradle:

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

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

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 23
                buildToolsVersion '23.0.3'
            }
        }
    }
}

app/build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * 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
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

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

    defaultConfig {
        applicationId "com.viva"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true
        multiDexEnabled true
    }
    dexOptions {
      javaMaxHeapSize "2g"
    }
    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"
        }
    }
    // 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-contacts')
    compile project(':tipsi-twitter')
    compile project(':react-native-view-shot')
    compile project(':react-native-twitter')
    compile project(':react-native-sinch-verification')
    compile project(':react-native-photo-view')
    compile project(':react-native-permissions')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-image-sequence')
    compile project(':react-native-fbsdk')
    compile project(':react-native-check-app-install')
    compile project(':react-native-camera')
    compile project(':react-native-blur')
    compile(project(':react-native-billing')) {
      exclude group: "com.google.android.gms"
    }
    compile project(':react-native-calendar-events')
    compile ("com.google.android.gms:play-services-base:11.0.4") {
      force = true;
    }
    compile ("com.google.android.gms:play-services-maps:11.0.4") {
      force = true;
    }
    compile 'com.android.support:multidex:1.0.1'
    compile(project(':react-native-maps')) {
      exclude group: "com.google.android.gms"
    }
    compile(project(':react-native-firebase')) {
      transitive = false
      exclude group: "com.google.android.gms"
      exclude group: "com.google.firebase"
    }
    compile project(':react-native-qrcode-local-image')
    compile ("com.google.firebase:firebase-core:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-analytics:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-auth:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-config:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-crash:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-database:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-messaging:11.0.4") {
        force = true;
    }
    compile ("com.google.firebase:firebase-storage:11.0.4") {
        force = true;
    }
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.3"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'com.facebook.fresco:animated-base-support:0.11.0'
    // For animated GIF support
    compile 'com.facebook.fresco:animated-gif:0.11.0'
    // For WebP support, including animated WebP
    compile 'com.facebook.fresco:animated-webp:0.11.0'
    compile 'com.facebook.fresco:webpsupport:0.11.0'
}

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

MainActivity.java:

package com.viva;

import com.facebook.react.ReactActivity;
import com.reactnative.photoview.PhotoViewPackage;
import android.content.Intent;

public class MainActivity extends ReactActivity {

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
    }

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "VIVA";
    }
}

MainApplication.java:

package com.viva;

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.gettipsi.reactnativetwittersdk.TwitterReactPackage;
import fr.greweb.reactnativeviewshot.RNViewShotPackage;
import ga.piroro.rnt.RNTPackage;
import com.kevinresol.sinchverification.SinchVerificationPackage;
import com.reactnative.photoview.PhotoViewPackage;
import com.joshblour.reactnativepermissions.ReactNativePermissionsPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import dk.madslee.imageSequence.RCTImageSequencePackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.rpt.reactnativecheckpackageinstallation.CheckPackageInstallationPackage;
import com.lwansbrough.RCTCamera.RCTCameraPackage;
import com.cmcewen.blurview.BlurViewPackage;
import com.idehub.Billing.InAppBillingBridgePackage;
import com.calendarevents.CalendarEventsPackage;
import com.remobile.qrcodeLocalImage.RCTQRCodeLocalImagePackage;
import io.fabric.sdk.android.Fabric;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; // Firebase Analytics
import io.invertase.firebase.auth.RNFirebaseAuthPackage; // Firebase Auth
import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage; // Firebase Remote Config
import io.invertase.firebase.crash.RNFirebaseCrashPackage; // Firebase Crash Reporting
import io.invertase.firebase.database.RNFirebaseDatabasePackage; // Firebase Realtime Database
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; // Firebase Cloud Messaging
import io.invertase.firebase.storage.RNFirebaseStoragePackage; // Firebase Storage

import java.util.Arrays;
import java.util.List;

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 ReactNativeContacts(),
            new TwitterReactPackage(),
            new RNViewShotPackage(),
            new RNTPackage(),
            new SinchVerificationPackage(),
            new PhotoViewPackage(),
            new ReactNativePermissionsPackage(),
            new RCTImageSequencePackage(),
            new CheckPackageInstallationPackage(),
            new RCTCameraPackage(),
            new BlurViewPackage(),
            new InAppBillingBridgePackage(),
            new CalendarEventsPackage(),
            new RCTQRCodeLocalImagePackage(),
            new RNFirebasePackage(),
            new RNFirebaseAnalyticsPackage(),
            new RNFirebaseAuthPackage(),
            new RNFirebaseRemoteConfigPackage(),
            new RNFirebaseCrashPackage(),
            new RNFirebaseDatabasePackage(),
            new RNFirebaseMessagingPackage(),
            new RNFirebaseStoragePackage(),
            new FBSDKPackage(mCallbackManager),
              new LinearGradientPackage()
      );
    }
  };

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

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
    FacebookSdk.sdkInitialize(getApplicationContext());
    // If you want to use AppEventsLogger to log events.
    AppEventsLogger.activateApp(this);
  }
}

AndroidManifest.xml:

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

    <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.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="VIVA"
      android:icon="@drawable/app_icon"
      android:theme="@style/AppTheme"
      tools:node="replace">
     <activity
        android:name=".SplashActivity"
        android:exported="true"
        android:launchMode="singleTop"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize"
        android:theme="@style/SplashTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
        </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:scheme="com.viva" />
        </intent-filter>
      </activity>
      <activity android:name=".MainActivity"
        android:exported="true"
        android:launchMode="singleTop"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">
      </activity>

      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="{KEY}"/>
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

      <provider android:authorities="com.facebook.app.FacebookContentProvider111111111111111"
          android:name="com.facebook.FacebookContentProvider"
          android:exported="true" />

      <service
        android:name="io.invertase.firebase.messaging.MessagingService"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
          <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
      </service>
      <service android:name="io.invertase.firebase.messaging.InstanceIdService" android:exported="false">
        <intent-filter>
          <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
      </service>

      <receiver android:name="io.invertase.firebase.messaging.RNFirebaseLocalMessagingPublisher"/>
      <receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.messaging.RNFirebaseSystemBootEventReceiver">
        <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>

      <meta-data
            android:name="io.fabric.ApiKey"
            android:value="{KEY}"/>

    </application>

</manifest>

I also have the google-services.json from Firebase in the /android/app/ folder

Environment

  1. Target Platform (e.g. iOS, Android): Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): Android Studio 2.3.3
  4. React Native version (e.g. 0.45.1): 0.47.2
  5. RNFirebase Version (e.g. 2.0.2): 2.1.3
Ehesp commented 7 years ago

Can we see your JS code usage please?

arminsal1 commented 7 years ago

@Ehesp Sure thing! I initialized in a separate Firebase.js file and then imported that into my app's Home.js file.

Firebase.js:

import RNFirebase from 'react-native-firebase'

const firebase = RNFirebase.initializeApp({
  // config options
  debug: true,
  persistence: true,
  APIKey: "{API-KEY}",
  databaseURL: "{My-DatabaseURL-String}",
  storageBucket: "{My-StorageBucket-String}"
});

export default firebase;

Then I just imported like so: import firebase from "./components/Firebase";

The error is especially puzzling because the JS setup runs with no issues on iOS.

arminsal1 commented 7 years ago

@Ehesp Any updates? Tried debugging more on the android side with no success.

chrisbianca commented 7 years ago

The Firebase SDK should be initialised automatically on Android. I'd suggest checking your application's startup logs to make sure there aren't any errors - it could be that there's something invalid in your google-services.json, or something else going wrong at startup.

arminsal1 commented 7 years ago

@chrisbianca I appreciate you taking the time to help me out! I have an iOS programming background so Android debugging is a struggle for me. I tried downloading the latest google-services.json from firebase and replaced the old one, but the error persists. This is my Android Studio output:

08-30 11:04:27.244 6633-6633/com.viva I/art: Not late-enabling -Xcheck:jni (already on)
08-30 11:04:27.244 6633-6633/com.viva W/art: Unexpected CPU variant for X86 using defaults: x86
08-30 11:04:27.277 6633-6633/com.viva V/fb-UnpackingSoSource: locked dso store /data/user/0/com.viva/lib-main
08-30 11:04:27.278 6633-6633/com.viva V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
08-30 11:04:27.278 6633-6633/com.viva V/fb-UnpackingSoSource: so store dirty: regenerating
08-30 11:04:27.313 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libRSSupport.so: deferring to libdir

                                                     [ 08-30 11:04:27.313  1560: 1581 D/         ]
                                                     HostConnection::get() New Host Connection established 0x878aec40, tid 1581
08-30 11:04:27.313 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libblasV8.so: deferring to libdir
08-30 11:04:27.313 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libfb.so: deferring to libdir
08-30 11:04:27.313 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libfolly_json.so: deferring to libdir
08-30 11:04:27.313 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libgifimage.so: deferring to libdir
08-30 11:04:27.314 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libglog.so: deferring to libdir
08-30 11:04:27.314 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libglog_init.so: deferring to libdir
08-30 11:04:27.314 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libgnustl_shared.so: deferring to libdir
08-30 11:04:27.314 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libicu_common.so: deferring to libdir
08-30 11:04:27.314 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libimagepipeline.so: deferring to libdir
08-30 11:04:27.315 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libjsc.so: deferring to libdir
08-30 11:04:27.315 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libreactnativejni.so: deferring to libdir
08-30 11:04:27.315 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/librsjni.so: deferring to libdir
08-30 11:04:27.315 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libstatic-webp.so: deferring to libdir
08-30 11:04:27.316 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libwebp.so: deferring to libdir
08-30 11:04:27.316 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libwebpimage.so: deferring to libdir
08-30 11:04:27.316 6633-6633/com.viva D/ApkSoSource: not allowing consideration of lib/x86/libyoga.so: deferring to libdir
08-30 11:04:27.316 6633-6633/com.viva V/fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
08-30 11:04:27.317 6633-6633/com.viva V/fb-UnpackingSoSource: starting syncer worker
08-30 11:04:27.332 6633-6633/com.viva V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.viva/lib-main (from syncer thread)
08-30 11:04:27.333 6633-6633/com.viva V/fb-UnpackingSoSource: not releasing dso store lock for /data/user/0/com.viva/lib-main (syncer thread started)
08-30 11:04:27.338 6633-6633/com.viva W/com.facebook.internal.Validate: FacebookActivity is not declared in the AndroidManifest.xml, please add com.facebook.FacebookActivity to your AndroidManifest.xml file. See https://developers.facebook.com/docs/android/getting-started for more info.
08-30 11:04:27.407 6633-6633/com.viva W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
08-30 11:04:27.416 6633-6659/com.viva D/NetworkSecurityConfig: No Network Security Config specified, using platform default
08-30 11:04:27.493 6633-6633/com.viva D/ReactNative: ReactInstanceManager.ctor()
08-30 11:04:27.513 6633-6633/com.viva D/ReactNative: ReactInstanceManager.createReactContextInBackground()
08-30 11:04:27.513 6633-6633/com.viva D/ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
08-30 11:04:27.533 6633-6633/com.viva W/unknown:ReactNative: Packager connection already open, nooping.
08-30 11:04:27.533 6633-6633/com.viva W/unknown:ReactNative: Inspector connection already open, nooping.
08-30 11:04:27.613 6633-6681/com.viva I/OpenGLRenderer: Initialized EGL, version 1.4
08-30 11:04:27.613 6633-6681/com.viva D/OpenGLRenderer: Swap behavior 1
08-30 11:04:27.644 6633-6681/com.viva E/EGL_emulation: tid 6681: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
08-30 11:04:27.644 6633-6681/com.viva W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x9f583340, error=EGL_BAD_MATCH
08-30 11:04:27.801 6633-6681/com.viva E/EGL_emulation: tid 6681: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
08-30 11:04:27.801 6633-6681/com.viva W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x8f524260, error=EGL_BAD_MATCH
08-30 11:04:27.998 6633-6633/com.viva D/ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
08-30 11:04:28.004 6633-6633/com.viva I/art: Thread[1,tid=6633,Native,Thread*=0xa7e8b400,peer=0x74bae610,"main"] recursive attempt to load library "/data/app/com.viva-1/lib/x86/libfb.so"
08-30 11:04:28.006 6633-6633/com.viva D/ReactNative: ReactInstanceManager.recreateReactContextInBackground()
08-30 11:04:28.006 6633-6633/com.viva D/ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
08-30 11:04:28.007 6633-6696/com.viva D/ReactNative: ReactInstanceManager.createReactContext()
08-30 11:04:28.018 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
08-30 11:04:28.019 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
08-30 11:04:28.022 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
08-30 11:04:28.022 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
08-30 11:04:28.022 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
08-30 11:04:28.022 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
08-30 11:04:28.023 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
08-30 11:04:28.024 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
08-30 11:04:28.027 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
08-30 11:04:28.029 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
08-30 11:04:28.030 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
08-30 11:04:28.032 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
08-30 11:04:28.033 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
08-30 11:04:28.035 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
08-30 11:04:28.037 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
08-30 11:04:28.039 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
08-30 11:04:28.039 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
08-30 11:04:28.040 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
08-30 11:04:28.040 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
08-30 11:04:28.041 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
08-30 11:04:28.042 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
08-30 11:04:28.044 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
08-30 11:04:28.045 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
08-30 11:04:28.045 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
08-30 11:04:28.046 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
08-30 11:04:28.051 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
08-30 11:04:28.052 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
08-30 11:04:28.053 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
08-30 11:04:28.054 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
08-30 11:04:28.056 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
08-30 11:04:28.056 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
08-30 11:04:28.058 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
08-30 11:04:28.058 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
08-30 11:04:28.058 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
08-30 11:04:28.060 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
08-30 11:04:28.060 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
08-30 11:04:28.060 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.reactnative.photoview.PhotoViewManager
08-30 11:04:28.064 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class dk.madslee.imageSequence.RCTImageSequenceManager
08-30 11:04:28.066 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.lwansbrough.RCTCamera.RCTCameraViewManager
08-30 11:04:28.067 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.cmcewen.blurview.BlurViewManager
08-30 11:04:28.068 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLikeViewManager
08-30 11:04:28.069 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLoginButtonManager
08-30 11:04:28.072 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBSendButtonManager
08-30 11:04:28.073 6633-6696/com.viva W/art: Before Android 4.1, method boolean com.facebook.share.widget.ShareButtonBase.canShare() would have incorrectly overridden the package-private method in android.widget.TextView
08-30 11:04:28.073 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBShareButtonManager
08-30 11:04:28.074 6633-6696/com.viva W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.BV.LinearGradient.LinearGradientManager
08-30 11:04:28.087 6633-6696/com.viva D/RNFirebaseAnalytics: New instance
08-30 11:04:28.089 6633-6696/com.viva E/unknown:ReactNative: Exception in native call
                                                             java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.viva. Make sure to call FirebaseApp.initializeApp(Context) first.
                                                                 at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
                                                                 at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
                                                                 at io.invertase.firebase.auth.RNFirebaseAuth.<init>(RNFirebaseAuth.java:56)
                                                                 at io.invertase.firebase.auth.RNFirebaseAuthPackage.createNativeModules(RNFirebaseAuthPackage.java:26)
                                                                 at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
                                                                 at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1071)
                                                                 at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1042)
                                                                 at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:980)
                                                                 at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
                                                                 at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:802)
                                                                 at java.lang.Thread.run(Thread.java:761)
08-30 11:04:28.145 6633-6681/com.viva E/EGL_emulation: tid 6681: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
08-30 11:04:28.145 6633-6681/com.viva W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x8f5244a0, error=EGL_BAD_MATCH

Are you able to see any problem points?

chrisbianca commented 7 years ago

I've just compared this to my app starting up, and I have the following as an entry in the log:

08-30 16:18:39.152 13289 13289 I FirebaseInitProvider: FirebaseApp initialization successful

I don't do anything specifically to do this, it's done automatically on start up, so I'm not quite sure why yours isn't doing the same.

The only thing I wonder is whether the configuration is incorrect - e.g. the package name doesn't match, or the SHA is set incorrectly

arminsal1 commented 7 years ago

@chrisbianca Do you mean checking to see if my package name and SHA match what's in my Google Developer account?

chrisbianca commented 7 years ago

@arminsal1 Yes, exactly. Validate that the package name in your AndroidManifest.xml is what is specified in the Firebase console project setup, and also that the SHA matches as well.

arminsal1 commented 7 years ago

@chrisbianca I went into my dashboard settings and the package name matches, but I don't have any SHA. Is that necessary for Firebase? The library worked for me without it before, but that was during v1.x so I'm not sure if that makes a difference.

Update: I found my Debug SHA1 in Android Studio and added it to my Firebase settings, but the problem persists. This error is killing me

chrisbianca commented 7 years ago

@arminsal1 I'm really not sure what to suggest. You look to have done everything that's required to get it up and running. All I could perhaps suggest is starting a clean project, adding RNFirebase to that and getting it working, then porting over anything that's different to your existing project?

arminsal1 commented 7 years ago

@chrisbianca Alright, it looks like that's my only choice at this point. Thank you, I appreciate your help

arminsal1 commented 7 years ago

Upgrading my project to RN 0.48 seemed to clean up whatever issue I was having and now it's running smoothly on Android with RNFirebase V3 😎

Ehesp commented 7 years ago

I guess it was down to some file not being initilized somewhere - joys of RN!

yuoppp commented 6 years ago

The issue is up in RN 0.52.2 I'll try to figure out what's happening out there

yuoppp commented 6 years ago
01-30 17:51:29.450 11639 15249 E unknown:ReactNative: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.qsoft.rentdemo. Make sure to call FirebaseApp.initializeApp(Context) first.
01-30 17:51:29.450 11639 15249 E unknown:ReactNative:   at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
01-30 17:51:29.450 11639 15249 E unknown:ReactNative:   at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
01-30 17:51:29.450 11639 15249 E unknown:ReactNative:   at io.invertase.firebase.messaging.RNFirebaseMessaging.getToken(RNFirebaseMessaging.java:71)
01-30 17:59:10.198 12300 12300 E FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
01-30 17:59:10.200  1347  2609 W ActivityManager: Unable to start service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=org.telegram.messenger (has extras) } U=0: not found
01-30 17:59:10.200 12300 12300 E FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
01-30 18:00:35.053 12300 12300 E FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
01-30 18:00:35.054  1347  2694 W ActivityManager: Unable to start service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=org.telegram.messenger (has extras) } U=0: not found
01-30 18:00:35.055 12300 12300 E FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
01-30 18:00:35.075 12300 12300 E FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
01-30 18:00:35.076  1347  2123 W ActivityManager: Unable to start service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=org.telegram.messenger (has extras) } U=0: not found
01-30 18:00:35.077 12300 12300 E FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
01-30 18:02:27.140 16080 16080 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
01-30 18:02:27.154 16080 16080 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
01-30 18:02:27.178 16080 16080 I FA      :   adb shell setprop debug.firebase.analytics.app ru.yandex.metro
01-30 18:02:27.187 16080 16080 I FirebaseInitProvider: FirebaseApp initialization successful

The first log message tells us that FirebaseApp is not initialized. And the last log is initializing of Firebaseapp.

Firebaseapp is initialized too late: 10 seconds after it was attempted to use

yuoppp commented 6 years ago

Okay. I don't know what was the problem.

Solved by:

  1. completely removed all react-native-firebase references in android/ folder: manually unlinked the project, remove 'apply plugin' at the bottom of android/app/build.gradle file, removed gms dependency in android/build.gradle, cleaned AndroidManifest.xml from react-native-firebase services and receivers
  2. npm uninstall --save react-native-firebase
  3. cd android && ./gradlew clean

Then installed the latest version as described here: https://rnfirebase.io/docs/v3.2.x/installation/initial-setup

Then I had to update all my play-services dependencies in android/app/build.gradle to 11.6.0 version, because firebase is using 11.6.0 at the moment I'm writing this post.

Here is how my android/app/build.gradle dependencies block looks like:

dependencies {

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

    // Firebase dependencies
    compile "com.google.firebase:firebase-core:11.6.0"
    compile "com.google.firebase:firebase-messaging:11.6.0"

    compile project(':react-native-background-timer')

    compile(project(':react-native-maps')) {
        exclude group: 'com.google.android.gms'
    }

    compile (project(':react-native-device-info')) {
        exclude group: "com.google.android.gms" 
    }

    compile (project(':react-native-camera')) {
    exclude group: "com.google.android.gms"
    }

    compile project(':react-native-image-picker')
    compile project(':react-native-oauth')
    compile project(':react-native-svg')
    compile project(':react-native-vector-icons')
    compile project(':react-native-device-info')
    compile project(path: ':react-native-interactable')
    compile project(':react-native-photo-view')

    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.google.android.gms:play-services-base:11.6.0") {
        force = true;
    }
    compile ("com.google.android.gms:play-services-maps:11.6.0") {
        force = true;
    }
    compile ("com.google.android.gms:play-services-gcm:11.6.0") {
        force = true;
    }

    compile project(':react-native-facebook-login')
    compile project(':react-native-check-app-install')
    compile project(':react-native-fetch-blob')

    compile project(':non-conflicting-webview')
}

Hope this will help somebody....

am9072 commented 5 years ago

Reason and solution: This is the common error you will get most of the time. Reason: when you integrate your project with the Firebase it adds the dependencies implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.android.gms:play-services-auth:16.0.1' and classpath classpath 'com.google.gms:google-services:4.1.0'

you just need to update them This is how you can update https://youtu.be/5d1g9aqczIE

aprilmintacpineda commented 4 years ago

I'm experiencing this issue on version 6 but only when I enable remote debugging... Any help?

"@react-native-firebase/app": "^6.3.4",
"react-native": "0.61.5",

I find it very odd that the documentation of version 5 seems to be more robust than version 6. I'm completely newbie in firebase and I'm having trouble learning this as there are almost no resources for version 6, I can see some resources for version 5 and the docs of v5 is a lot better.

jmongtalvof commented 4 years ago

I have the same error but I am not using firebase at all in my app... do you know why that may be

nguyenduy2392 commented 4 years ago

I'm experiencing this issue on version 6 but only when I enable remote debugging... Any help?

"@react-native-firebase/app": "^6.3.4",
"react-native": "0.61.5",

I find it very odd that the documentation of version 5 seems to be more robust than version 6. I'm completely newbie in firebase and I'm having trouble learning this as there are almost no resources for version 6, I can see some resources for version 5 and the docs of v5 is a lot better.

i think you missing add classpath 'com.google.gms:google-services:4.3.2' and apply plugin: 'com.google.gms.google-services'

mikehardy commented 4 years ago

For anyone still paying attention, here is a from-scratch demonstrator script, built from the v6+ docs (which are I think pretty robust actually?) - https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh

aprilmintacpineda commented 4 years ago

For anyone still paying attention, here is a from-scratch demonstrator script, built from the v6+ docs (which are I think pretty robust actually?) - https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh

Is react-native-firebase doing the same things on react-native link? so that means, after linking (which they said in latest react-native is no longer required to be ran manually) everything should work well, including when you enable debug mode, correct? What I'm missing is, I followed what the documentation said but cannot enable debug mode, it worked well if I don't enable debug mode, but then I can't debug efficiently, then I learned about the firebase react-native template and I tried it out, to my surprise, it works as I expected, I will try to create a replicate repo and post it here.

maxammann commented 3 years ago

For all who have problems to enable Debugging Mode of RN while after adding firebase messaging to their project.

The appears if you have firebase in your project (with auto-linking) but firebase is not (yet) configured properly:

As soon as you enter Debugging Mode the JS is executed in Chrome instead of the Android JS engine (Hermes/JSC). Now it seems like if you use chrome then getConstants is called when you start the app. This will trigger the exception if firebase is not configured before getConstants is called. In Hermes it seems like getConstants is not called directly when the app starts but only when you access firebase via a JS import.

You can fix this by configuring firebase through the The Google Services Gradle Plugin: https://developers.google.com/android/guides/google-services-plugin Alternatively you can also skip this plugin and do all manually as we do: https://github.com/Integreat/integreat-app/blob/88fb78693185749799297db4ed90a8f1b4bf5232/native/android/app/buildConfigs.gradle#L50

mikehardy commented 3 years ago

Very interesting - I'm aware that running under the RN debugger can affect JS execution but had not thought of this impact. @maxammann if there is some place in the docs where you could briefly warn people that running under the RN debugger will cause app initialization to fail under X, Y, Z circumstances that might be helpful for future people

maxammann commented 3 years ago

@mikehardy sadly I don't have time to spend more time on this issue. I just hope that people will find this issue.

Therefore here some keywords to find this issue: Debugging Mode Firebase React Native getContext initializeApp

ashish-hexalitics commented 1 year ago

this is android/build.gradle

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

buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33

    // We use NDK 23 which hasm both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}

dependencies {
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath 'com.google.gms:google-services:4.3.15'
}

}

this is android/app/build.gradle

apply plugin: "com.android.application" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' // <- Add this line

/**

/**

/**

android { ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.digianafresh"
defaultConfig {
    applicationId "com.digianafresh"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 37
    versionName "3.1.7"
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' }

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}
implementation project(':payu-non-seam-less-react')
// implementation project(':react-native-firebase')
// implementation platform('com.google.firebase:firebase-bom:28.2.1')
// implementation 'com.google.firebase:firebase-installations:17.2.0'
implementation platform('com.google.firebase:firebase-bom:32.6.0')
implementation('com.google.firebase:firebase-analytics')
// implementation("com.google.firebase:firebase-app")
// implementation("com.google.firebase:firebase-messaging")

}

// buildscript { // dependencies { // // ... other dependencies // // NOTE: if you are on react-native 0.71 or below, you must not update // // the google-services plugin past version 4.3.15 // classpath 'com.google.gms:google-services:4.4.0' // // Add me --- /\ // } // }

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

this is an AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.digianafresh" xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:ignore="CoarseFineLocation" />

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:theme="@style/AppTheme" tools:node="replace">

<!-- <meta-data android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token"/> -->

<activity
  android:name=".MainActivity"
  android:label="@string/app_name"
  android:theme="@style/SplashTheme"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
  android:launchMode="singleTask"
  android:windowSoftInputMode="adjustResize"
  android:exported="true">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>
<activity android:name="com.payu.ui.view.activities.CheckoutActivity"
  android:exported="false" />
<meta-data android:name="com.google.android.geo.API_KEY"
  android:value="AIzaSyCxiRDyR13T32dU_VdNRyoiO9_4xhmt5dA" />
<meta-data android:name="com.google.android.gms.version" android:value="12451000" />
<meta-data
  android:name="google_analytics_adid_collection_enabled"
  android:value="false" />
<!--      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />-->

<!-- firebase -->

<service android:name="com.google.firebase.components.ComponentDiscoveryService"
  android:directBootAware="true" android:exported="false">
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
  <meta-data
    android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />

</service>

<service
  android:name="com.google.firebase.messaging.FirebaseMessagingService"
  android:exported="true">
  <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>

<receiver
  android:name="com.google.firebase.messaging.FirebaseMessagingReceiver"
  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>

<!-- firebase -->

here I'm getting error

Default Firebase App is not initialized in this process com.digianafresh. Make sure to call Firebase App.InitializeApp(Context) first. 26 27 28 requestUserPermission()

image

mikehardy commented 1 year ago

@ashish-hexalitics this is a closed issue, please do not post on closed issues, especially if they are from years ago, that's bad form as it pings all the participants of a dead issue with your likely unrelated information.

Open a new issue if you need to please

ashish-hexalitics commented 1 year ago

okay i will take care of it

On Wed, Dec 6, 2023 at 10:39 PM Mike Hardy @.***> wrote:

@ashish-hexalitics https://github.com/ashish-hexalitics this is a closed issue, please do not post on closed issues, especially if they are from years ago, that's bad form as it pings all the participants of a dead issue with your likely unrelated information.

Open a new issue if you need to please

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/360#issuecomment-1843310678, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBZEN4UVUBDR5DXI2WPG6HDYICRCXAVCNFSM4DYNV7A2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUGMZTCMBWG44A . You are receiving this because you were mentioned.Message ID: @.***>