cordova-plugin-flurryanalytics icon indicating copy to clipboard operation
cordova-plugin-flurryanalytics copied to clipboard

Ionic Native: tried accessing the FlurryAnalytics plugin but it's not installed

Open dlazzy opened this issue 5 years ago • 0 comments

Hello,

There is my specs :

cli packages:

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.2.1
    Cordova Platforms  : android 6.4.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v7.8.0
    npm               : 5.7.1 
    OS                : Linux 4.15

The plugin version is :

"@ionic-native/flurry-analytics": "^4.20.0"
"cordova-plugin-flurryanalytics": "^1.4.6"

Code is (in app.component.ts) :

import { Component, ViewChild } from '@angular/core';
import { Platform, Nav } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { OneSignal } from '@ionic-native/onesignal';
import { FlurryAnalytics, FlurryAnalyticsObject, FlurryAnalyticsOptions } from '@ionic-native/flurry-analytics';
import { OS_APP_ID, OS_PROJECT_ID, FA_APP_ID } from '../providers/config';

@Component({
  templateUrl: 'app.html'
})
export class mApp {
  @ViewChild(Nav) navChild: Nav;
  rootPage: any;
  options: FlurryAnalyticsOptions = {
    appKey: FA_APP_ID,
    reportSessionsOnClose: true,
    enableLogging: true
  };
  fa: FlurryAnalyticsObject;

  constructor(private platform: Platform,
    private statusBar: StatusBar,
    private splashScreen: SplashScreen,
    private oneSignal: OneSignal,
    private flurryAnalytics: FlurryAnalytics) {

    this.fa = this.flurryAnalytics.create(this.options);
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => {
      if (window.hasOwnProperty('cordova')) {
        this.oneSignal
          .startInit(OS_APP_ID, OS_PROJECT_ID)
          .inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification)
          .endInit();
        this.fa.logEvent('open app')
          .then(() => console.log('Logged open app'))
          .catch(e => console.log('Error logging the event open app', e));
      }
      this.rootPage = 'HomePage';
      this.statusBar.styleLightContent();
      this.statusBar.backgroundColorByHexString('#292929');
      this.splashScreen.hide();
    });
  }
}

When compiling app to Android phone with ionic cordova build android it works perfectly, when compiling with ionic cordova build android --prod this show an error in console Ionic Native: tried accessing the FlurryAnalytics plugin but it's not installed.

Thanks for the help.

dlazzy avatar Feb 08 '19 09:02 dlazzy