Cordova variants (PhoneGap CLI, Cordova, Ionic, and Intel XDK) 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.
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
config.xml and add
<preference name="android-minSdkVersion" value="15" /> under your
<platform name="android"> section.
<platform name="android"> <preference name="android-minSdkVersion" value="15" /> </platform>
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.
phonegap-facebook-plugin - Remove and this and use
plugin.google.maps - Make sure you are using version 1.2.8 of Google Map plugin or newer which is compatible with
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
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
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.
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.
'com.phonegap.plugins.facebookconnect' remove the following.
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />
'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" />
'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.
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.
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.
Make sure you are testing on an Android or iOS device. The OneSignal Cordova plugin does not load on a browser.
window.plugins.OneSignalwas called to soon. Double check your code with 2. Add required code to make sure your calling OneSignal from the correct spot.
Make sure you have included
index.htmland it is BEFORE any other scripts.
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.
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.
Remove the following line from your
<preference name="AndroidLaunchMode" value="standard" />