EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

App Immediately Crashes After Installing #1808

Closed joshmossas closed 3 years ago

joshmossas commented 3 years ago

My Environment:

OS: Windows 10 CLI: Nativescript v8.0.1 Android Runtime: @nativescript/android 8.0.0 IOS Runtime: @nativescript/ios 8.0.0 Webpack: @nativescript/webpack 5.0.0-beta.3 Test Device: Android Emulator (API v29) Flavor: Nativescript-Vue

Details

Basically after installing this plugin and running ns run android. Webpack will compile successfully and I get the message Successfully installed on device with identifier 'emulator-5554'. However on the device itself the app will open then immediately crash and no error is given in the console. When I try to reopen the app in the emulator I get the following message:

image

My package.json

{
    "name": "mobile-nativescript",
    "main": "app/app.ts",
    "displayName": "My App",
    "version": "0.0.1",
    "description": "NativeScript Application",
    "author": "[redacted]",
    "license": "SEE LICENSE IN ../../../../LICENSE",
    "nativescript": {
        "id": "com.adviise.mobile"
    },
    "scripts": {
        "dev": "concurrently \"npm run css:watch\" \"vue-devtools\" \"ns run --no-hmr\"",
        "css": "postcss styles/tailwind.css --env development -o app/app.css",
        "css:watch": "postcss styles/tailwind.css --env development -o app/app.css -w",
        "css:build": "postcss styles/tailwind.css --env production -o app/app.css"
    },
    "bugs": {
        "url": "https://github.com/NativeScript/NativeScript/issues"
    },
    "files": [
        "app",
        "App_Resources",
        "hooks",
        "tools",
        "!tools/assets",
        "types",
        ".editorconfig",
        "tsconfig.json"
    ],
    "keywords": [],
    "dependencies": {
        "@nativescript-community/perms": "^2.1.5",
        "@nativescript/core": "^8.0.1",
        "@nativescript/firebase": "^11.1.3",
        "@nativescript/theme": "~3.0.1",
        "@nstudio/nativescript-camera-plus": "^4.0.2",
        "@nstudio/nativescript-exoplayer": "^5.0.6",
        "@triniwiz/nativescript-socketio": "^4.0.1",
        "@triniwiz/nativescript-toasty": "^4.1.3",
        "@vue/composition-api": "^1.0.0-rc.6",
        "@vue/devtools": "^5.3.4",
        "nativescript-tailwind": "^2.0.1",
        "nativescript-videoplayer": "^5.0.1",
        "nativescript-vue": "~2.9.0",
        "nativescript-vue-devtools": "^1.5.1",
        "tailwindcss": "^2.1.1",
        "vue": "^2.6.12",
        "vue-devtools": "^5.1.4",
        "vuex": "^3.6.2",
        "xmldom": "^0.5.0"
    },
    "devDependencies": {
        "@nativescript/android": "8.0.0",
        "@nativescript/ios": "8.0.0",
        "@nativescript/types": "~8.0.0",
        "@nativescript/webpack": "5.0.0-beta.3",
        "@types/node": "^14.14.37",
        "@typescript-eslint/eslint-plugin": "^4.21.0",
        "@typescript-eslint/parser": "^4.21.0",
        "autoprefixer": "^10.2.5",
        "concurrently": "^6.0.1",
        "eslint": "^7.24.0",
        "eslint-config-airbnb-base": "^14.2.1",
        "eslint-config-prettier": "^8.1.0",
        "eslint-plugin-import": "^2.22.1",
        "eslint-plugin-vue": "^7.8.0",
        "nativescript-vue-template-compiler": "~2.9.0",
        "postcss": "^8.2.9",
        "postcss-cli": "^8.3.1",
        "prettier": "^2.2.1",
        "tsconfig-paths-webpack-plugin": "^3.5.1",
        "typescript": "^4.2.4"
    },
    "private": "true"
}

My App Resources image

My App_Resources/Android/app.gradle

// Add your native dependencies here:
dependencies {
    // implementation 'com.android.support:recyclerview-v7:+'
  implementation 'com.twilio:video-android:6.3.0'
}

android {
  defaultConfig {
    minSdkVersion 17
    generatedDensities = []
    multiDexEnabled true
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
  compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
}

My nativescript.config.ts

import { NativeScriptConfig } from '@nativescript/core';

export default {
    id: 'com.adviise.mobile',
    appPath: 'app',
    appResourcesPath: 'App_Resources',
    android: {
        v8Flags: '--expose_gc',
        markingMode: 'none',
    },
} as NativeScriptConfig;

My firebase.nativescript.json

{
    "using_ios": true,
    "using_android": true,
    "analytics": true,
    "firestore": true,
    "realtimedb": false,
    "authentication": true,
    "remote_config": false,
    "performance_monitoring": true,
    "external_push_client_only": false,
    "messaging": true,
    "in_app_messaging": false,
    "crashlytics": true,
    "storage": true,
    "functions": true,
    "facebook_auth": true,
    "google_auth": true,
    "admob": true,
    "dynamic_links": true,
    "ml_kit": false
}

Things I've Tried

When I uninstalling @nativescript/firebase the app builds fine but as soon as I install this plugin I get this problem again.

guillemc23 commented 3 years ago

I'm getting a similar behaviour on Angular but using NS7

joshmossas commented 3 years ago
{
    "using_ios": true,
    "using_android": true,
    "analytics": true,
    "firestore": true,
    "realtimedb": true,
    "authentication": true,
    "remote_config": false,
    "performance_monitoring": false,
    "external_push_client_only": false,
    "messaging": false,
    "in_app_messaging": false,
    "crashlytics": false,
    "storage": false,
    "functions": false,
    "facebook_auth": true,
    "google_auth": true,
    "admob": false,
    "dynamic_links": false,
    "ml_kit": false
}

I turned off some of the features and did ns plugin remove @nativescript/firebase and then ns plugin add @nativescript/firebase and now it's working. I haven't determined which Firebase feature is causing the crash though.

joshmossas commented 3 years ago

I've identified that admob is the one that's causing the problem. For anyone seeing this set admob to false in your firebase.nativescript.json and then run ns plugin remove @nativescript/firebase followed by ns plugin add @nativescript/firebase and the crash should no longer happen.

joshmossas commented 3 years ago

Closing this as crash is a result of an incomplete Admob setup as outlined in the instructions here. https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/ADMOB.md#android