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

Installation problem.

Open sunglee opened this issue 7 years ago • 2 comments

Hi,

I followed the installation direction as described in this repo. However, I got the following error when I run react-native run-android. Am I missing anything?

JS server already running.
Running /Users/me/Library/Android/sdk/platform-tools/adb reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module react-native-firebase-analytics : Configuration with name 'default' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.929 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Thanks for your help.

sunglee avatar Aug 10 '16 20:08 sunglee

I was able to run without any issues. For some reasons, rnpm link react-native-firebase-analytics didn't make right changes. Here are working changed that I had to add manually:

In /android/settings.gradle,

rootProject.name = 'Your_Project_Name'
include ':app', ...other modules you use, ':react-native-firebase-analytics'
project(':react-native-firebase-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-analytics/android') //<-- add this

In /android/build.gradle,

   dependencies {
      classpath 'com.google.gms:google-services:3.0.0' //<-- add this as described in installation
   }

In /android/app/build.gradle, (per #17)

apply plugin: 'com.google.gms.google-services' //<-- add this at the bottom of the file

And finally in /androi/app/src/main/java/.../MainApplication.java,

import com.evollu.react.fa.FIRAnalyticsPackage; //<-- add this in the lines of imports

//and at a little down below
   return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new FIRAnalyticsPackage() //<-- add this
   )

Hope this helps.

sunglee avatar Aug 10 '16 21:08 sunglee

@sunglee can u close this? or could u add this info to README?

sibelius avatar Dec 08 '16 17:12 sibelius