I have installed firebase into my react native app, I will need to firebase analytics module.
app/build.gradle:
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation "com.google.android.gms:play-services-gcm:16.0.0"
implementation "com.google.firebase:firebase-messaging:20.0.1"
implementation "com.google.firebase:firebase-analytics:17.2.1"
MainActivity.java
private FirebaseAnalytics mFirebaseAnalytics;
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, R.style.SplashScreenTheme); // here
super.onCreate(savedInstanceState);
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}
react native
import firebase from "react-native-firebase";
firebase.analytics().logEvent("your_custom_event", {"custom_parm": "cp_value"});
but I get this error on logcat console on android studio:
E/ReactNativeJS: Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.analytics().
Ensure you have:
1) Installed the required Firebase Android SDK dependency 'com.google.firebase:firebase-analytics' in your 'android/app/build.gradle' file.
2) Imported the 'io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage' module in your 'MainApplication.java' file.
3) Added the 'new RNFirebaseAnalyticsPackage()' line inside of the RN 'getPackages()' method list.
See http://invertase.link/android for full setup instructions.
and in react native console I see:
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy