Ionic: Unfortunately, app has stopped

I have designed an ionic app (ionic 3.3.0 and angular 4.1.2). Then i added lazy load to the app. I am getting this error “Unfortunately, app has stopped”, When app loads. Could anyone help me, How to fix it?
Thanks

Don’t write broken code :wink:

Does your app work in ionic serve?
How are you building your app?

@Sujan12 It worked fine in ionic serve and ionic cordova run android. But it was not working when i generated an apk.

Ok good.

How are you building your apk?
What exact commands are you executing?

Do you have any code that tries to figure out the name of the current page from the navigation system? That breaks under minification.

I am using these commands for generating the apk:

  1. ionic cordova build android --prod --release
  2. jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore app.keystore platforms/android/build/outputs/apk/android-release-unsigned.apk appName
  3. $ANDROID_HOME/build-tools/23.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk appName.apk

No . I m not using anything like that. Its not breaking minification. i m getting " unfortunately app has stopped" while running app in device.

  1. Did the app work properly with ionic serve?
  2. Did the app work with ionic cordova build android?
  3. Did the app work with ionic cordova build android --prod?

I fixed It. The problem was google play services.Because i have push notification in my app. So its needed google play services. So i installed google play services from SDK. Then app worked fine.

Thanks!

2 Likes

i am also facing same problem here… the issue is not solved please suggest me is there any alternative i would check… for the issue to solve…

1 Like

i also installed google play services from SDK, but no success, app is crashes again, please help me out of this , its very urgent for me.

Do you remember what steps you’ve executed to solve it?

I could solve the problem by removing and re-adding the android platform.

Remove android platform. And then add it again.

  1. ionic cordova platform remove android
  2. ionic cordova platform add android

Then all should work perfectly.

1 Like