OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Troubleshooting Cordova Variants

Common setup issues with Cordova and Cordova Variants like PhoneGap and Ionic

🚧

PhoneGap Cloud Build Users

PhoneGap Cloud Build may not be supported further by Adobe. You will want to change to PhoneGap CLI to continue using the OneSignal SDK.

Updating SDK

Most common bugs are solved by updating the OneSignal SDK to the latest version. See our latest releases and change log. If you already have a Cordova app running OneSignal, you can run this command to ensure that you are on the latest version of the onesignal-cordova-plugin:

cordova plugin update onesignal-cordova-plugin

Troubleshooting steps:

Please follow all steps below. If you are still having issues, please reach out to support with a log generated from Step 6.

1. Double Check Setup Guide

Return to our Cordova SDK Setup, Ionic SDK Setup or PhoneGap SDK Setup Guides to make sure you followed all steps and added any updates.

2. Use the latest Cordova Version

You should be using Cordova 8.0.0 or newer
For Android, you are using Cordova [email protected] or newer and make sure your JDK is updated to the latest version.
For iOS, you are using Cordova [email protected] or newer and if using CocoaPods, make sure you have version 1.2.0 or newer installed.

3. Test on Mobile Device

You must test on an actual device, not the browser.

4. Update OneSignal

Update to the latest version of the OneSignal SDK. See our Github Changelog for Version Details

Cordova Users, run:
cordova plugin rm onesignal-cordova-plugin
cordova plugin add onesignal-cordova-plugin

Ionic Users, run:
ionic cordova plugin remove onesignal-cordova-plugin
ionic cordova plugin add onesignal-cordova-plugin

PhoneGap Users, run:
phonegap plugin rm onesignal-cordova-plugin
phonegap plugin add onesignal-cordova-plugin

5. Run a clean build of your app.

Cordova variants (PhoneGap CLI, Cordova, Ionic) are known to have issues with plugins not fully getting added to your project in some cases. If you see an error in LogCat or Xcode like call to unknown plugin: OneSignalPush or having issues seeing users on our dashboard please follow these step to do a clean build of your project:

phonegap plugins list
phonegap plugin rm onesignal-cordova-plugin
    + Remove any other plugins one at a time from the list command.
rm -rf platforms/android
rm -rf platforms/ios

phonegap platform add android
phonegap platform add ios
phonegap plugin add onesignal-cordova-plugin
phonegap plugin add cordova-plugin-whitelist (# required for android)
    + Add back any other plugins you had.
cordova plugins list
cordova plugin rm onesignal-cordova-plugin
    + Remove any other plugins one at a time from the list command.
rm -rf platforms/android
rm -rf platforms/ios

cordova platform add android
cordova platform add ios
cordova plugin add onesignal-cordova-plugin
cordova plugin add cordova-plugin-whitelist (# required for android)
    + Add back any other plugins you had.
ionic cordova plugins list
ionic cordova plugin rm onesignal-cordova-plugin
    + Remove any other plugins one at a time from the list command.
rm -rf platforms/android
rm -rf platforms/ios

ionic cordova platform add android
ionic cordova platform add ios
ionic cordova plugin add onesignal-cordova-plugin
ionic cordova plugin add cordova-plugin-whitelist (# required for android)
    + Add back any other plugins you had.

6. Check below for common issues and if still not sure, send us a log.

After running through the rest of this Troubleshooting guide, use the OneSignal SDK setLogLevel method to Verbose and send us the full logcat from the device when reproducing the behavior.

//The following options are available with increasingly more information: 
//0 = NONE, 1 = FATAL, 2 = ERROR, 3 = WARN, 4 = INFO, 5 = DEBUG, 6 = VERBOSE
window.plugins.OneSignal.setLogLevel({logLevel: 6, visualLevel: 0});

If you need help interpreting the logs, please share them through Pastebin to help our support and engineering team assist you.


Missing CoreGraphics & WebKit Libraries

Undefined symbol: OBJC_CLASS$_WKWebViewConfiguration
Undefined symbol: OBJC_CLASS$_WKWebView
Undefined symbol: _CGAffineTransformIdentity
Undefined symbol: _CGAffineTransformMakeScale
If you get the above errors, you are missing the **CoreGraphics** and **WebKit** libraries. These should have been added automatically. If they weren't you can fix the errors by adding those libraries under **Link Binary With Libraries**. 


[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/aed4058-64882639-2ab1b700-d623-11e9-870f-5d0e756b4cc5.png",
        "64882639-2ab1b700-d623-11e9-870f-5d0e756b4cc5.png",
        662,
        279,
        "#2b2a28"
      ]
    }
  ]
}
[/block]


----

## Plugin Install Failure
<div class="label-all label-type"><span class="label-ios">iOS</span></div>

The following error will happen if CocoaPods is not installed when adding the OneSignal plugin.
Installing "onesignal-cordova-plugin" for iOS
        Failed to install 'onesignal-cordova-plugin': Error: pod: Command failed with exit code 31
            at ChildProcess.whenDone (/Users/vagrant/git/platforms/ios/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
            at emitTwo (events.js:106:13)
            at ChildProcess.emit (events.js:194:7)
            at maybeClose (internal/child_process.js:899:16)
            at Socket.<anonymous> (internal/child_process.js:342:11)
            at emitOne (events.js:96:13)
            at Socket.emit (events.js:191:7)
            at Pipe._handle.close [as _onclose] (net.js:511:12)
        Failed to restore plugin "onesignal-cordova-plugin" from config.xml. You might need to try adding it again. Error: Error: pod: Command failed with exit code 31

You will need to install CocoaPods with the following commands from the terminal.

sudo gem install cocoapods
pod repo update

cordova plugin rm onesignal-cordova-plugin
cordova plugin add onesignal-cordova-plugin --save

Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [com.onesignal:OneSignal:3.6.2]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [com.onesignal:OneSignal:3.6.2] /home/user/cordova_project/platforms/android/build/intermediates/exploded-aar/com.onesignal/OneSignal/3.6.2/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.onesignal" to force usage
Open your `config.xml` and add `<preference name="android-minSdkVersion" value="15" />` under your `<platform name="android">` section.
```

Compatibility With Other Android Plugins

Android, Amazon

If you get a compile error when building for Android about the "Android Support Library" or "Google Play services" (gms) please double check that you have both of them install show in step 3 of PhoneGap SDK Setup, Cordova SDK Setup, Ionic SDK Setup, Intel XDK Setup.

Facebook

com.phonegap.plugins.facebookconnect or phonegap-facebook-plugin - Remove and this and use cordova-plugin-facebook4 instead.

Google Maps

plugin.google.maps - Make sure you are using version 1.2.8 of Google Map plugin or newer which is compatible with onesignal-cordova-plugin.

Google Analytics

cordova-plugin-google-analytics - If you're using version 0.7.1 you can update to 0.8.1 to fix the build compatibility issue. If you need to stay on version 0.7.1 you can remove onesignal-cordova-plugin and add onesignal-cordova-plugin-pgb-compat instead.

com.adobe.plugins.GAPlugin - This plugin hasn't been updated since 2014 and conflicts with many plugins. You will need to switch a more compatible plugin such as cordova-plugin-google-analytics.

If you are using any other push notification plugins please remove them as having multiple push plugins can create issues like duplicate notifications and subscribing issues. A known issue is pushbots-cordova-plugin is not compatible with OneSignal and will need to be removed.

If you had to make any plugin changes above you may need to follow our Clean Build instructions above to get the project compiling if you're still seeing errors.


PhoneGap Build (PGB) - Compatibility With Other Android Plugins

Android, Amazon

If you're using Adobe's PhoneGap Build Cloud service to build your app and using another plugin that references "Google Play services" or the "Android Support library" (v4 or v13) you will need to remove the duplicate libraries. This includes dex errors such as com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; Please check if you have any of the plugins below in your config.xml and follow the instructions for them below.

When using 'com.phonegap.plugins.facebookconnect' remove the following.

<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />

When using 'com.admob.google' remove the following 2 lines.

<gap:plugin name="cordova-plugin-googleplayservices" source="npm" />
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />

If using 'de.appplant.cordova.plugin.local-notification' replace it with the following:

<gap:plugin name="cordova-plugin-local-notifications" source="npm" />

If you have com.phonegap.plugins.pushplugin we recommend remove this as having 2 push notification providers can create issues. If you must have this plugin along side OneSignal you will to use the new phonegap-plugin-push plugin which replaced it.
NOTE: The phonegap-plugin-push will cause no push token issue with OneSignal on iOS so you must remove it if you need iOS support.

<gap:plugin name="phonegap-plugin-push" source="npm" version="1.5.2" />

If you are using any other push notification plugins please remove them as having multiple push plugins can create a number of issues.

If you having issues with any other plugins try find the latest version of npmjs as PhoneGap Build's plugin directories are deprecated and can no longer be updated by developers.


Uncaught TypeError: Cannot read property 'OneSignal' of undefined

Android, Amazon, iOS

If you're seeing this error in your adb logcat (Android) or Xcode log then this means window.plugins was currently undefined when OneSignal was used. There are a few possible causes.

  1. Make sure you are testing on an Android or iOS device. The OneSignal Cordova plugin does not load on a browser.

  2. window.plugins.OneSignal was called to soon. Double check your code with 2. Add required code to make sure your calling OneSignal from the correct spot.

  3. Make sure you have included cordova.js into your index.html and it is BEFORE any other scripts.

<script src="cordova.js"></script>

Unexpected call to didRegisterForRemoteNotificationsWithDeviceToken, ignoring

Android, Amazon, iOS

The Unexpected call to didRegisterForRemoteNotificationsWithDeviceToken, ignoring comes from the phonegap-plugin-push and is known to interfere with other push notifications plugins. Please remove it by running cordova plugin rm phonegap-plugin-push and OneSignal should start working in your project.

Android - Build error - "play-services-gcm"

Android, Amazon
com.google.android.gms:play-services-gcm:+ as no versions of com.google.android.gms:play-services-gcm are available.

Double check that Google Repository is installed show in 3. Android of our setup instructions.

Android - App is reloading instead of resuming when opening a notification

Remove the following line from your config.xml.

<preference name="AndroidLaunchMode" value="standard" />

Updated 21 days ago



Troubleshooting Cordova Variants


Common setup issues with Cordova and Cordova Variants like PhoneGap and Ionic

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.