NativeScript / firebase

Modular Firebase 🔥 implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
https://docs.nativescript.org/plugins/firebase-core.html
Apache License 2.0
56 stars 50 forks source link

[firebase-crashlytics][android] recordError just doesn't work #76

Closed coolboy0961 closed 2 years ago

coolboy0961 commented 2 years ago

I called the recordError looks like following way.

image

I used debug mode to confirm crashlytics event. When I start the app, I can confirm following info, I think the crashlytics init is fine. But just noting happened when I execute recordError.

image

I tried to send crash event by using firebase().crashlytics().crash();. It works.

image image

By the way, firebase().analytics().logEvent(key, parameters); works fine too.

My environment info:

OS: macOS 12.1
CPU: (10) arm64 Apple M1 Max
Shell: /bin/zsh
node: 14.17.0
npm: 6.14.13
nativescript: 8.2.2

# android
java: 11.0.14.1
ndk: Not Found
apis: 29, 30, 31
build_tools: 29.0.3, 30.0.3, 32.0.0, 32.1.0
system_images: 
  - android-31 | Google Play ARM 64 v8a

# ios
xcode: 13.3/13E113
cocoapods: 1.11.3
python: 3.9.7
python3: 3.9.7
ruby: 3.0.2
platforms: 
  - DriverKit 21.4
  - iOS 15.4
  - macOS 12.3
  - tvOS 15.4
  - watchOS 8.5

Dependencies


"dependencies": {
  "@nativescript-community/ui-lottie": "^4.1.2",
  "@nativescript/auto-fit-text": "^1.0.1",
  "@nativescript/core": "^8.1.5",
  "@nativescript/firebase-analytics": "^1.2.0",
  "@nativescript/firebase-core": "^1.2.0",
  "@nativescript/firebase-crashlytics": "^1.2.0",
  "@nativescript/iqkeyboardmanager": "^2.0.0",
  "@nativescript/secure-storage": "^3.0.0",
  "@nativescript/theme": "~3.0.1",
  "@nstudio/nativescript-loading-indicator": "^4.1.0",
  "@nstudio/nativescript-tracking-transparency": "^1.0.0",
  "@plmservices/nativescript-outline-label": "^2.0.2",
  "axios": "0.21.1",
  "lodash": "^4.17.21",
  "maskdata": "^1.1.4",
  "nativescript-clipboard": "^2.1.1",
  "nativescript-dna-deviceinfo": "^3.7.1",
  "nativescript-vue": "~2.9.0",
  "nativescript-vue-router-ns": "^1.0.4",
  "url-parse": "^1.5.3",
  "vue-class-component": "^7.2.6",
  "vue-property-decorator": "^9.1.2",
  "vuelidate-property-decorators": "^1.0.28",
  "vuex": "^3.6.2",
  "vuex-class": "^0.3.2",
  "vuex-module-decorators": "^1.0.1"
},
"devDependencies": {
  "@babel/preset-env": "^7.14.2",
  "@nativescript/android": "^8.1.1",
  "@nativescript/eslint-plugin": "0.0.4",
  "@nativescript/ios": "^8.1.0",
  "@nativescript/types": "^8.1.1",
  "@nativescript/webpack": "5.0.0",
  "@types/jest": "^26.0.23",
  "@types/lodash": "^4.14.170",
  "@types/node": "~14.6.2",
  "@types/vuelidate": "^0.7.14",
  "@typescript-eslint/eslint-plugin": "^4.27.0",
  "@typescript-eslint/parser": "^4.27.0",
  "@vue/eslint-config-typescript": "^7.0.0",
  "@vue/test-utils": "^1.2.2",
  "axios-mock-adapter": "^1.19.0",
  "babel-core": "^7.0.0-bridge.0",
  "babel-jest": "^26.6.3",
  "cli-table": "https://github.com/telerik/cli-table/tarball/v0.3.1.2",
  "cpx": "^1.5.0",
  "eslint": "^7.28.0",
  "eslint-config-prettier": "^8.3.0",
  "eslint-plugin-prettier": "^3.4.0",
  "eslint-plugin-vue": "^7.11.1",
  "flush-promises": "^1.0.2",
  "jest": "^26.6.3",
  "jest-html-reporter": "^3.4.0",
  "jest-sonar-reporter": "^2.0.0",
  "license-checker": "^25.0.1",
  "marked-terminal": "https://github.com/NativeScript/marked-terminal/tarball/v3.1.1n",
  "nativescript": "^8.1.5",
  "nativescript-vue-jest": "^3.0.4",
  "nativescript-vue-template-compiler": "~2.9.0",
  "npm-run-all": "^4.1.5",
  "prettier": "^2.3.0",
  "sonarqube-scanner": "^2.8.1",
  "tns-platform-declarations": "^6.5.15",
  "ts-jest": "^26.5.6",
  "typescript": "~4.0.0",
  "vue": "^2.6.12",
  "vue-eslint-parser": "^7.6.0",
  "vue-jest": "^3.0.7",
  "vue-template-compiler": "^2.6.12"
}
fpaaske commented 2 years ago

recordError() takes an instance of Error or a native NSError/Exception. Maybe that's the problem?

Try firebase().crashlytics().recordError(new Error('test')); and see if that works.

coolboy0961 commented 2 years ago

@fpaaske Thank you. I tried it, but no luck.

triniwiz commented 2 years ago

Working in the demo, which filter(s) are you using on the fb console ?

coolboy0961 commented 2 years ago

@triniwiz

I confirmed Crashlytics of firebase web console. I didn't use any filter.

I notised about this log.

image

Even I write firebase().crashlytics().setCrashlyticsCollectionEnabled(true); or set it in AndroidManifest.xml, firebase_crashlytics_enabled always is false.

image image

Could this be the reason?

triniwiz commented 2 years ago

After logging the events try closing/reopening the app , that should cause the app the upload the previously logged events. Also I noticed if I set the filters to 60 mins my logs didn't not show , after setting it to 24hrs it managed to show up

coolboy0961 commented 2 years ago

@triniwiz You are right. When I restart the app, crashlytics log is sent. Because I always test every pattern by uninstall and install new version of app, I didn't start same app again... Thanks you so much.

image

@fpaaske Thank you very much too. I found that only the instance of Error type can be sent, string is NG, the instance of CustomError extended Error is NG too.