Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Manual installation

Christian Brevik edited this page Nov 30, 2017 · 5 revisions

Manual installation iOS

  1. npm install --save react-native-google-analytics-bridge

  2. In XCode, right-click the Libraries folder under your project ➜ Add Files to <your project>.

  3. Go to node_modulesreact-native-google-analytics-bridgeiosRCTGoogleAnalyticsBridge and add the RCTGoogleAnalyticsBridge.xcodeproj file.

  4. Go to your apps project settings ➜ "Build Phases" ➜ "Link Binary With Libraries" and add libRCTGoogleAnalyticsBridge.a from the linked project.

  5. Next you will have to link a few more SDK framework/libraries which are required by GA (if you do not already have them linked.) Go to your project settings (root folder on the left pane) ➜ "Build Phases" ➜ "Link Binary With Libraries" then click the + and add the following:

    1. CoreData.framework
    2. SystemConfiguration.framework
    3. libz.tbd
    4. libsqlite3.0.tbd
  6. Optional step: If you plan on using the advertising identifier (IDFA), then you need to do two things:

    1. Add AdSupport.framework under "Link Binary With Libraries". (As with the other frameworks in step 5).
    2. Go to Xcode ➜ LibrariesRCTGoogleAnalyticsBridge.xcodeproj ➜ right-click google-analytics-lib. Here you need to Add files to .., and add libAdIdAccess.a from the google-analytics-lib directory. This directory is located in the same node_modules path as in step 3.
    3. (Optional): In order to avoid having to re-add libAdIDAccess.a each time you install dependencies, consider patching the react-native-google-analytics-bridge dependency to add this automatically for you: https://blog.novanet.no/easier-react-native-upgrade-with-patch-package/

Prerequisites for Android

Make sure you have the following SDK packages installed in the Android SDK Manager:

  • Google Repository
  • Google Play services
  • Google APIs (Atom) system image

Consult this guide if you are unsure how to do this.

Manual installation Android

  1. npm install --save react-native-google-analytics-bridge
  2. Add the following in android/settings.gradle
...
include ':react-native-google-analytics-bridge', ':app'
project(':react-native-google-analytics-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-analytics-bridge/android')
  1. And the following in android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-google-analytics-bridge')
}
  1. Register package in MainApplication.java
// Step 1; import package:
import com.idehub.GoogleAnalyticsBridge.GoogleAnalyticsBridgePackage;

public class MainApplication extends Application implements ReactApplication {
  ...

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            // Step 2; register package:
            new GoogleAnalyticsBridgePackage()
        );
    }
}