当我尝试使用Flurry插件记录事件时出现此错误: https://github.com/blakgeek/cordova-plugin-flurryanalytics
((当我使用firebase-analytics插件时出现相同的错误,但我也无法解决该错误: https://github.com/chemerisuk/cordova-plugin-firebase-analytics)
我在insights.ts(one of my component)
的{{1}}中使用的代码:
ionViewWillEnter()
运行应用程序时出现错误:
const options: FlurryAnalyticsOptions = {
appKey: 'my key', // REQUIRED
userId: 'prash1234',
reportSessionsOnClose: true,
enableLogging: true
}
let fa: FlurryAnalyticsObject = this.flurry.create(options);
let ovenParams = {
temp: 350,
mode: 'convection',
rackPosition: 'center'
}
fa.logEvent('set oven', ovenParams)
.then(() => { console.log('something')})
.catch((e) => console.log('error'));
我的包裹json:
ERROR TypeError: Object(...) is not a function
at FlurryAnalyticsObject.logEvent (index.js:26)
at InsightsPage.webpackJsonp.171.InsightsPage.ionViewWillEnter (insights.ts:60)
at ViewController._lifecycle (view-controller.js:566)
at ViewController._willEnter (view-controller.js:454)
at Tab.NavControllerBase._willEnter (nav-controller-base.js:966)
at nav-controller-base.js:828
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4149)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
ionic -v
{
"name": "myFlurryApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/app-version": "^4.19.0",
"@ionic-native/core": "^4.19.0",
"@ionic-native/device": "^4.19.0",
"@ionic-native/fcm": "^4.5.2",
"@ionic-native/flurry-analytics": "^5.2.0",
"@ionic-native/google-analytics": "^4.19.0",
"@ionic-native/keyboard": "^4.19.0",
"@ionic-native/local-notifications": "^4.6.0",
"@ionic-native/push": "4.0.1",
"@ionic-native/splash-screen": "^4.19.0",
"@ionic-native/status-bar": "^4.19.0",
"@ionic/storage": "2.0.1",
"@types/lodash": "^4.14.91",
"cordova-android": "7.1.4",
"cordova-ios": "4.5.5",
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-cocoapod-support": "1.6.0",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "2.4.0",
"cordova-plugin-flurryanalytics": "1.4.6",
"cordova-plugin-google-analytics": "1.8.6",
"cordova-plugin-ionic-keyboard": "2.1.3",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-whitelist": "1.3.3",
"datepicker-ionic2": "^2.6.2",
"highcharts": "^4.2.6",
"ion2-calendar": "^2.2.0",
"ionic-angular": "3.6.1",
"ionic-select-searchable": "^2.8.2",
"ionicons": "3.0.0",
"moment": "^2.22.2",
"rxjs": "^5.5.12",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "2.1.4",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-app-version": {},
"cordova-plugin-device": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-google-analytics": {
"GMS_VERSION": "11.0.1"
},
"cordova-plugin-fcm-with-dependecy-updated": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-flurryanalytics": {}
},
"platforms": [
"ios",
"android"
]
}
}
Android
4.3.0
请帮助我。 谢谢:)
答案 0 :(得分:0)
解决这个问题:
切换flurry插件的版本。
然后在android文件中更改服务(flurry service)的版本。使其与插件相同。
PS:虽然我不会推荐这个插件,它会在你构建你的 iOS 项目时导致一个大问题。如果他们去年解决了 iOS 的构建问题,那么您肯定可以使用它。
编辑:
现在有了离子和电容器,你可以解决这个问题。
npm install cordova-plugin-flurryanalytics
npm install @ionic-native/flurry-analytics
ionic cap sync