Ionic working on browser but not working on real device

I want to add FCM Notification in my ionic project. My project working succesfull in browser. But it not working on device. When i run cordova run android , app installed the phone. But the application is stopped. This event happened after installing the FCM add-in. https://github.com/fechanique/cordova-plugin-fcm plugin I tried another plugin, but the result didn’t change. https://ionicframework.com/docs/v3/native/fcm/ I want to look at Inspect Devices if there is an error. But it closes quickly, I can’t see any errors.

It also works successfully from the phone when I delete the plug-in.

How can I solve this problem?

I tried cordova platform remove android and cordova platform add android but not working still.

cordova run android

Android Studio project detected
Discovered saved plugin "mx.ferreyra.callnumber". Adding it to the project
Plugin "call-number" already installed on android.
ANDROID_HOME=C:\Users\Meftun\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
config.xml
../config.xml
../../config.xml
../../../config.xml
preference = 9
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 19
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 3000
name = GOOGLE_MAPS_ANDROID_API_KEY, value = XXXXXXXXXXXXXXXXXXXXXXXX
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_6lv694c3ptnyjchvmgsyczu8h.run(C:\Users\Meftun\Desktop\IonicAktif\kurye-musteri2\kurye-musteri\platforms\android\app\build.gradle:154)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:transformClassesWithStackFramesFixerForDebug UP-TO-DATE
:app:transformClassesWithDesugarForDebug UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
:app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:cdvBuildDebug UP-TO-DATE

BU�LD SUCCESSFUL in 12s
46 actionable tasks: 1 executed, 45 up-to-date
Built the following apk(s):
        C:\Users\Meftun\Desktop\IonicAktif\kurye-musteri2\kurye-musteri\platforms\android\app\build\outputs\apk\debug\app-debug.apk
ANDROID_HOME=C:\Users\Meftun\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
No target specified, deploying to device 'XXXXXXXXXXXXXXXXXXXXXXXX'.
none
Skipping build...
Built the following apk(s):
        C:\Users\Meftun\Desktop\IonicAktif\kurye-musteri2\kurye-musteri\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Using apk: C:\Users\Meftun\Desktop\IonicAktif\kurye-musteri2\kurye-musteri\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Package name: com.kuryemex.cebindekikurye
LAUNCH SUCCESS

ionic info

Ionic:

   ionic (Ionic CLI)  : 4.12.0 (C:\Users\Meftun\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.3
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 19 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\Meftun\AppData\Local\Android\sdk)
   NodeJS            : v8.9.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

cordova plugin list

call-number 0.0.2 "Cordova Call Number Plugin"
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-background-geolocation-lt 2.14.2 "BackgroundGeolocation"
cordova-open-native-settings 1.5.2 "Native settings"
cordova-plugin-advanced-http 2.0.9 "Advanced HTTP plugin"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-fcm 2.1.2 "FCMPlugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-nativegeocoder 3.2.1 "NativeGeocoder"
cordova-plugin-request-location-accuracy 2.2.3 "Request Location Accuracy"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.3 "Whitelist"

I’m running ionic 4 so I’m not sure if this will help but try using cordova-plugin-fcm-with-dependecy-updated plugin instead

I tried this plugin. So this is same

Isn’t there anyone who can help?

@mustafabekec - I found success in resolving this just now by running the following:

  • cordova platform remove android
  • cordova platform add android

This effectively updated me from cordova-platform-android@7.1.2 --> corodova-platform-android@8.0.0 and ultimately fixed the issue. I imagine it’s actually something to do with one of the plugins that you’re using (I see a few in common with my own plugin list). But this seems to work - for now.

Hope this helps!

1 Like

I found that the problem was caused by the plugin I used. I used the Firebase plugin and my problem was solved.