Ionic cordova run with –prod stuck at splash for iOS and Android

I have problem when I build the app using --prod flag for both iOS and android it stuck and freeze on splash screen, can any one help me please. below my xml and json file.

<preference name=“ScrollEnabled” value=“false” />
<preference name=“android-minSdkVersion” value=“19” />
<preference name=“BackupWebStorage” value=“none” />
<preference name=“SplashShowOnlyFirstTime” value=“false” />
<preference name=“SplashScreen” value=“screen” />
<preference name=“SplashScreenDelay” value=“3000” />
<preference name=“loadUrlTimeoutValue” value=“70000” />
<preference name=“FadeSplashScreen” value=“false” />
<preference name=“AutoHideSplashScreen” value=“false” />
<preference name=“SplashMaintainAspectRatio” value=“true” />
<preference name=“FadeSplashScreenDuration” value=“800” />

and package.json

{
“name”: “”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“start”: “ionic-app-scripts serve”,
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”
},
“dependencies”: {
@agm/core”: “^1.0.0-beta.5”,
@agm/snazzy-info-window”: “^1.0.0-beta.5”,
@angular/animations”: “7.1.4”,
@angular/common”: “7.1.4”,
@angular/compiler”: “7.1.4”,
@angular/compiler-cli”: “7.1.4”,
@angular/core”: “7.1.4”,
@angular/forms”: “7.1.4”,
@angular/http”: “7.1.4”,
@angular/platform-browser”: “7.1.4”,
@angular/platform-browser-dynamic”: “7.1.4”,
@ionic-native/camera”: “^4.18.0”,
@ionic-native/core”: “^4.18.0”,
@ionic-native/device”: “^4.18.0”,
@ionic-native/firebase”: “^4.18.0”,
@ionic-native/geolocation”: “^4.18.0”,
@ionic-native/google-plus”: “^4.18.0”,
@ionic-native/in-app-browser”: “^4.18.0”,
@ionic-native/keyboard”: “^4.18.0”,
@ionic-native/launch-navigator”: “^4.18.0”,
@ionic-native/photo-viewer”: “^4.18.0”,
@ionic-native/screen-orientation”: “^4.18.0”,
@ionic-native/social-sharing”: “^4.18.0”,
@ionic-native/splash-screen”: “~4.18.0”,
@ionic-native/status-bar”: “~4.18.0”,
@ionic/storage”: “2.2.0”,
@ngx-translate/core”: “^11.0.1”,
@ngx-translate/http-loader”: “^4.0.0”,
@servicestack/client”: “^1.0.15”,
@types/googlemaps”: “^3.30.16”,
“com-sarriaroman-photoviewer”: “1.1.18”,
“cordova-android”: “7.1.4”,
“cordova-browser”: “5.0.4”,
“cordova-ios”: “4.5.5”,
“cordova-plugin-actionsheet”: “^2.3.3”,
“cordova-plugin-camera”: “^4.0.3”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-dialogs”: “^2.0.1”,
“cordova-plugin-firebase”: “^2.0.5”,
“cordova-plugin-geolocation”: “^4.0.1”,
“cordova-plugin-inappbrowser”: “^3.0.0”,
“cordova-plugin-ionic-keyboard”: “^2.1.3”,
“cordova-plugin-ionic-webview”: “^3.1.1”,
“cordova-plugin-screen-orientation”: “^3.0.1”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“cordova-plugin-x-socialsharing”: “^5.4.4”,
“es6-promise-plugin”: “^4.2.2”,
“ionic-angular”: “3.9.2”,
“ionic3-star-rating”: “^1.1.5”,
“ionicons”: “4.5.5”,
“jquery”: “^3.3.1”,
“moment”: “^2.24.0”,
“ng2-simple-global”: “^1.2.5”,
“ngx-moment”: “^3.3.0”,
“rxjs”: “6.3.3”,
“rxjs-compat”: “^6.3.3”,
“snazzy-info-window”: “^1.1.1”,
“socket.io-client”: “^2.2.0”,
“sw-toolbox”: “3.6.0”,
“uk.co.workingedge.phonegap.plugin.launchnavigator”: “^4.2.2”,
“zone.js”: “0.8.29”
},
“devDependencies”: {
@ionic/app-scripts”: “3.2.1”,
@ionic/lab”: “1.0.19”,
“gradle”: “^1.0.9”,
“typescript”: “3.1.6”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-whitelist”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-ionic-keyboard”: {},
“cordova-plugin-screen-orientation”: {},
“cordova-plugin-geolocation”: {},
“cordova-plugin-inappbrowser”: {},
“cordova-plugin-camera”: {},
“cordova-plugin-x-socialsharing”: {
“ANDROID_SUPPORT_V4_VERSION”: “24.1.1+”
},
“uk.co.workingedge.phonegap.plugin.launchnavigator”: {
“OKHTTP_VERSION”: “3.+”,
“LOCATION_USAGE_DESCRIPTION”: “This app requires access to your location for navigation purposes”
},
“cordova-plugin-ionic-webview”: {
“ANDROID_SUPPORT_ANNOTATIONS_VERSION”: “27.+”
},
“cordova-plugin-firebase”: {},
“com-sarriaroman-photoviewer”: {}
},
“platforms”: [
“browser”,
“android”,
“ios”
]
}
}

Post your ionic info output please.

Did you remote debug the problem on the device already?
Follow these instructions here to debug the problem in Safari dev tools:
https://ionic.zone/debug/remote-debug-your-app#ios
Follow these instructions here to debug the problem in Chrome dev tools:
https://ionic.zone/debug/remote-debug-your-app#android
Look at the console and network tabs for errors.

What command exactly are you using to run your app?

Im using
ionic cordova build ios --prod (then using xcode)
ionic cordova build android --prod --aot --release (using the generated apk)

I have tried the remote debug using safari on similator but nothing found in console like the pic below.

I repeat:

So no output at all in console on both platforms?

--release is a very different command by the way.

sorry I forget ionic Info last comment, yes there is no output in console.

Ionic:

ionic (Ionic CLI) : 4.9.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.1

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 13 other plugins)

System:

ios-deploy : 1.9.2
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61

Can you use --prod on a newly created Ionic project with ionic start?

it is working with new project in both ios and android build with --prod.
this is the console log in xcode

2019-01-30 23:35:22.079443+0300 MyApp2[1436:29205] Apache Cordova native platform version 4.5.5 is starting.

2019-01-30 23:35:22.080408+0300 MyApp2[1436:29205] Multi-tasking -> Device: YES, App: YES

2019-01-30 23:35:22.135485+0300 MyApp2[1436:29205] CDVWKWebViewEngine: trying to inject XHR polyfill

2019-01-30 23:35:22.328397+0300 MyApp2[1436:29205] CDVWKWebViewEngine will reload WKWebView if required on resume

2019-01-30 23:35:22.328714+0300 MyApp2[1436:29205] Using Ionic WKWebView

2019-01-30 23:35:22.329932+0300 MyApp2[1436:29205] [CDVTimer][console] 0.240088ms

2019-01-30 23:35:22.330305+0300 MyApp2[1436:29205] [CDVTimer][handleopenurl] 0.147939ms

2019-01-30 23:35:22.334327+0300 MyApp2[1436:29205] [CDVTimer][intentandnavigationfilter] 3.875017ms

2019-01-30 23:35:22.334665+0300 MyApp2[1436:29205] [CDVTimer][gesturehandler] 0.116944ms

2019-01-30 23:35:22.334877+0300 MyApp2[1436:29205] CDVIonicKeyboard: resize mode 1

2019-01-30 23:35:22.336725+0300 MyApp2[1436:29205] [CDVTimer][keyboard] 1.728058ms

2019-01-30 23:35:22.370187+0300 MyApp2[1436:29205] [CDVTimer][splashscreen] 33.256054ms

2019-01-30 23:35:22.375913+0300 MyApp2[1436:29205] [CDVTimer][statusbar] 5.491972ms

2019-01-30 23:35:22.376109+0300 MyApp2[1436:29205] [CDVTimer][TotalPluginStartup] 46.502948ms

2019-01-30 23:35:24.499992+0300 MyApp2[1436:29205] Ionic Native: deviceready event fired after 331 ms

Then best copy over your app piece by piece and see when it starts breaking.

the problem is my program is ionic-3,
and when I copy it to new one (ionic4 now), I have to change a lot of codes.
how can I migrate the all of code to ionic 4 in simple way?

Don’t - just use the CLI to create a Ionic 3 project.

how can I do that?
now when I run ionic start tab,
it create ionic 4 I think. becouse I have updated my ionic -g

Documentation helps here: https://ionicframework.com/docs/cli/commands/start
The command is ionic start --type=ionic-angular

Im trying to create new project and transfer component/pages/models one by one and share the result again.

1 Like

Make sure to test regularly, so you know exactly when it breaks.

I have the same problem when using ionic v3:
ionic cordova run android --prod = freezes on splashscreen, no error in console
ionic cordova run android = app runs fine

any ideas?

Hi Corbis, I have the same problem, Im tryig to create new project and transfer the pages/plugings one by one , I will share the result with you in 2-3 days.

I’m having a similar problem with an Ionic V3 app running on iOS. It works fine but after a few days when I want to use the app again it just shows the splash screen and then quits.
It’s reproducible, though I can’t quite tell how many days it takes for it to become unresponsive.
After a reinstall on my phone via Xcode it runs again for a few days.

I have solved the problem by

  1. run new fresh ionic-3 project (ionic start --type=ionic-angular)
  2. transfer the app.component.ts and app.module.ts
  3. transfer the pages and plugins one by one.
  4. downgrade some plugins

please note that

  1. angular version is 5.2.11
  2. ionic native : 4.18.0
  3. typescript: “~2.6.2”
  4. “uk.co.workingedge.phonegap.plugin.launchnavigator”: “5.0.1”
  5. “com-sarriaroman-photoviewer”: “1.1.18”,
  6. “rxjs”: “5.5.11”,
  7. @ngx-translate/core”: “^9.0.0”,
  8. @ngx-translate/http-loader”: “^2.0.0”,

I solved this problem to by downgrading to

  1. typescript: “~2.6.2”
1 Like

I finally had some time to look at the console output:

/private/var/containers/Bundle/Application/F4F4AB60-1090-421F-A707-1608CD0F2224/Pricetracker.app/Pricetracker not valid: 0xe8008015: A valid provisioning profile for this executable was not found.

AMFI: code signature validation failed.

Failed to start job with error <NSError: 0x105509150; domain: NSPOSIXErrorDomain; code: 3; reason: “The process failed to exec”> {
description = “Unable to get valid task name port right for pid 6229”;
failureReason = “The process failed to exec”;
recoverySuggestion = “Consult /var/log/com.apple.xpc.launchd/launchd.log for more information”;
}

[io.ionic.pricetracker] Bootstrap failed with error: <NSError: 0x281d52be0; domain: BKSProcessErrorDomain; code: 1 (bootstrap-failed); reason: “Failed to start job”>

Bootstrapping failed for <FBApplicationProcess: 0x10c2dc1f0; io.ionic.pricetracker; pid: -1> with error: Error Domain=BKSProcessErrorDomain Code=1 “Unable to bootstrap process with bundleID io.ionic.pricetracker” UserInfo={NSLocalizedDescription=Unable to bootstrap process with bundleID io.ionic.pricetracker, BKSProcessExitReason=0, NSLocalizedFailureReason=Failed to start job, NSUnderlyingError=0x281d528b0 {Error Domain=NSPOSIXErrorDomain Code=3 “No such process” UserInfo={NSLocalizedFailureReason=The process failed to exec, NSLocalizedRecoverySuggestion=Consult /var/log/com.apple.xpc.launchd/launchd.log for more information, NSLocalizedDescription=Unable to get valid task name port right for pid 6229}}, BSErrorCodeDescription=bootstrap-failed}

And certainly the entry for my developer certificate was not anymore on the device under Settings–>General–>Device Management.

Re-installing the app via Xcode made the certificate reappear.

What I would like to know is, why does it disappear?