Onesignal-cordova-plugin: "android app has stopped" on device and emulator


#1

Hello

I have ionic app and with onesignal plugin. It worked fine with onesignal-cordova-plugin ver 2.1.0, but when updated to 2.4.1, it crashes instantly on device or emulator. Note that the plugin is just installed, not even imported in the app.

Anybody with similar problem or possibly solution?

package.json

{
  "name": "onesignal app",
  "version": "1.3.06",
  "author": "Dspot",
  "homepage": "http://dspot.si/",
  "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": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "5.0.3",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@ionic-native/app-version": "^4.7.0",
    "@ionic-native/badge": "^4.7.0",
    "@ionic-native/base64": "^4.7.0",
    "@ionic-native/calendar": "^4.7.0",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/date-picker": "^4.7.0",
    "@ionic-native/diagnostic": "^4.7.0",
    "@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/google-maps": "^4.8.2",
    "@ionic-native/image-picker": "^4.7.0",
    "@ionic-native/launch-navigator": "^4.7.0",
    "@ionic-native/location-accuracy": "^4.7.0",
    "@ionic-native/network": "^4.7.0",
    "@ionic-native/onesignal": "^4.7.0",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/pro": "^1.0.20",
    "@ionic/storage": "^2.1.3",
    "angular2-moment": "^1.9.0",
    "com-badrit-base64": "^0.2.0",
    "com.synconset.imagepicker": "^2.1.10",
    "cordova-android": "6.3.0",
    "cordova-browser": "~5.0.1",
    "cordova-ios": "~4.5.4",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-add-swift-support": "^1.7.2",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-calendar": "^5.1.0",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-datepicker": "^0.9.3",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-dialogs": "^2.0.1",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-image-picker": "^1.1.3",
    "cordova-plugin-ionic": "^2.0.4",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-photo-library": "^2.1.1",
    "cordova-plugin-request-location-accuracy": "^2.2.3",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-telerik-imagepicker": "^2.2.0",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.3.2",
    "cordova.plugins.diagnostic": "^4.0.8",
    "ionic-angular": "3.9.2",
    "ionic-cache": "^3.1.1",
    "ionic-cache-observable": "0.0.6",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-elastic-header": "0.0.10",
    "ionic2-super-tabs": "^4.1.5",
    "ionicons": "3.0.0",
    "ngx-moment": "^2.0.0",
    "onesignal-cordova-plugin": "^2.4.1",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.2.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.9",
    "typescript": "2.4.2",
    "ws": "3.3.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-datepicker": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-ionic": {
        "APP_ID": "f89d1bcb",
        "CHANNEL_NAME": "Master",
        "UPDATE_METHOD": "background",
        "UPDATE_API": "https://api.ionicjs.com",
        "MAX_STORE": "2"
      },
      "cordova-plugin-calendar": {
        "CALENDAR_USAGE_DESCRIPTION": "To add dates to your calendar"
      },
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "com.synconset.imagepicker": {
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "To choose photos for upload"
      },
      "cordova-plugin-request-location-accuracy": {},
      "cordova.plugins.diagnostic": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-camera": {},
      "com-badrit-base64": {},
      "cordova-plugin-photo-library": {
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "To choose photos"
      },
      "cordova-plugin-badge": {},
      "cordova-plugin-network-information": {},
      "uk.co.workingedge.phonegap.plugin.launchnavigator": {
        "LOCATION_USAGE_DESCRIPTION": "To access your location for navigation purposes"
      },
      "cordova-sqlite-storage": {},
      "onesignal-cordova-plugin": {}
    },
    "platforms": [
      "browser",
      "ios",
      "android"
    ]
  }
}

ionic info:

cli packages: (C:\Users\martin\AppData\Roaming\npm\node_modules)

    @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.1.9
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.11.1
    npm               : 6.0.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\martin\AppData\Local\Android\Sdk

Misc:

    backend : pro

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="1306" id="si.dspot.ikranj" version="1.3.06" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>iKranj</name>
    <description>Kranj na enem mestu</description>
    <author email="info@dspot.si" href="http://dspot.si/">Dspot d.o.o.</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenSpinnerColor" value="white" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
        <resource-file src="locales/android/drawable-mdpi/ic_stat_onesignal_default.png" target="res/drawable-mdpi/ic_stat_onesignal_default.png" />
        <resource-file src="locales/android/drawable-hdpi/ic_stat_onesignal_default.png" target="res/drawable-hdpi/ic_stat_onesignal_default.png" />
        <resource-file src="locales/android/drawable-xhdpi/ic_stat_onesignal_default.png" target="res/drawable-xhdpi/ic_stat_onesignal_default.png" />
        <resource-file src="locales/android/drawable-xxhdpi/ic_stat_onesignal_default.png" target="res/drawable-xxhdpi/ic_stat_onesignal_default.png" />
        <resource-file src="locales/android/drawable-xxxhdpi/ic_stat_onesignal_default.png" target="res/drawable-xxxhdpi/ic_stat_onesignal_default.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <allow-navigation href="http://172.27.208.161:8100" />
    <allow-navigation href="http://169.254.80.80:8100" />
    <allow-navigation href="http://192.168.99.1:8100" />
    <allow-navigation href="http://172.16.101.52:8100" />
    <engine name="browser" spec="~5.0.1" />
    <engine name="ios" spec="~4.5.4" />
    <engine name="android" spec="6.3.0" />
    <plugin name="cordova-plugin-datepicker" spec="^0.9.3" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-device" spec="^1.1.7" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
    <plugin name="cordova-plugin-ionic-webview" spec="^1.2.1" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-ionic" spec="^2.0.4">
        <variable name="APP_ID" value="f89d1bcb" />
        <variable name="CHANNEL_NAME" value="Master" />
        <variable name="UPDATE_METHOD" value="background" />
        <variable name="UPDATE_API" value="https://api.ionicjs.com" />
        <variable name="MAX_STORE" value="2" />
    </plugin>
    <plugin name="cordova-plugin-calendar" spec="^5.1.0">
        <variable name="CALENDAR_USAGE_DESCRIPTION" value="To add dates to your calendar" />
    </plugin>
    <plugin name="cordova-plugin-geolocation" spec="^2.4.3">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
    </plugin>
    <plugin name="com.synconset.imagepicker" spec="^2.1.10">
        <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="To choose photos for upload" />
    </plugin>
    <plugin name="cordova-plugin-request-location-accuracy" spec="^2.2.3" />
    <plugin name="cordova.plugins.diagnostic" spec="^4.0.8" />
    <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
    <plugin name="cordova-plugin-camera" spec="^4.0.3" />
    <plugin name="com-badrit-base64" spec="^0.2.0" />
    <plugin name="cordova-plugin-photo-library" spec="^2.1.1">
        <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="To choose photos" />
    </plugin>
    <plugin name="cordova-plugin-badge" spec="^0.8.7" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.1" />
    <plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^4.2.0">
        <variable name="LOCATION_USAGE_DESCRIPTION" value="To access your location for navigation purposes" />
    </plugin>
    <plugin name="cordova-sqlite-storage" spec="^2.3.2" />
    <plugin name="onesignal-cordova-plugin" spec="^2.4.1" />
</widget>


#2

I had the same problem , There is some problem with the new version of the plugin , fixed by removing the new version 2.4.1 , and installing the 2.4.0 one
1 - ionic cordova plugin remove onesignal-cordova-plugin
2 - ionic cordova plugin add onesignal-cordova-plugin@2.4.0

Good luck ! :blush:


#3

Thank you, solved my problem