¿Por que al compilar en ionic como --prod no funciona mi aplicación?

Compilando mi proyecto con ionic cordova build android mi aplicación corre sin problemas. Pero al hacerlo para producción ionic cordova build android --prod no pasa del SplashScreen, quedándose la pantalla en blanco.

No sé si tendrá algo que ver, pero uso una página inicial para comprobaciones, desde la cual voy cargando la página correspondiente: login, registro, home.

He accedido a la consola de chrome compilando con --prod y me aparece el siguiente error:

08:46:26.343 Native: tried calling File.dataDirectory, but the File plugin is not installed. E @ vendor.js:1

08:46:26.348 Install the File plugin: ‘ionic cordova plugin add cordova-plugin-file’ E @ vendor.js:1

08:46:26.366 ERROR TypeError: Cannot read property ‘replace’ of null at new o (main.js:1) at vendor.js:1 at re (vendor.js:1) at ne (vendor.js:1) at vendor.js:1 at re (vendor.js:1) at ne (vendor.js:1) at t.get (vendor.js:1) at Te (vendor.js:1) at Se (vendor.js:1)

El plugin ‘cordova-plugin-file’ está instalado correctamente, he probado a reinstalarlo y a instalar otras versiones.

Gracias y un saludo.

What is your ionic info output?

Hola @Sujan12,
aquí lo tienes:

Ionic:

ionic (Ionic CLI) : 4.1.2 (C:\Users\Administrador\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 1.2.1, (and 18 other plugins)

System:

NodeJS : v8.9.4 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

What output do you get when you run the --prod command?
Does ionic build --prod work?

Gracias,
acabo de probar npm update -g cordova.

Cordova Platforms : android 8.0.0

Sigue igual.
Aquí tienes el proceso ionic cordova build android --prod

C:\_programacion\cordova\appnew> ionic cordova build android --prod
ionic-app-scripts build --prod --target cordova --platform android
[17:13:11] ionic-app-scripts 3.2.0
[17:13:11] build prod started …
[17:13:11] clean started …
[17:13:11] clean finished in 3 ms
[17:13:11] copy started …
[17:13:11] deeplinks started …
[17:13:11] deeplinks finished in 182 ms
[17:13:11] ngc started …
[17:13:18] ngc finished in 7.35 s
[17:13:18] preprocess started …
[17:13:18] preprocess finished in 1 ms
[17:13:18] webpack started …
[17:13:19] copy finished in 7.74 s
[17:13:33] webpack finished in 14.41 s
[17:13:33] uglify started …
[17:13:33] sass started …
[17:13:34] sass finished in 1.08 s
[17:13:34] cleancss started …
[17:13:35] cleancss finished in 1.41 s
[17:13:46] uglify finished in 12.79 s
[17:13:46] postprocess started …
[17:13:46] postprocess finished in 13 ms
[17:13:46] lint started …
[17:13:46] build prod finished in 34.85 s
cordova build android
Android Studio project detected
Discovered plugin “mx.ferreyra.callnumber” in config.xml. Adding it to the project
Plugin “call-number” already installed on android.
ANDROID_HOME=C:\Users\administrador\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_161
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.
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_yt7mc4gei71q1m90vsyj53t.run(C:_programacion\cordova\appnew\platforms\android\app\build.gradle:147)
: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
OneSignalPlugin: WARNING: OneSignalPlugin: Downgraded ‘com.android.support:+’ -> 27.+ to prevent compile errors! Recommend updating your project’s compileSdkVersion!
: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
: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
:app:assembleDebug
:app:cdvBuildDebug

BUILD SUCCESSFUL in 9s
46 actionable tasks: 3 executed, 43 up-to-date
Built the following apk(s):
C:\_programacion\cordova\appnew\platforms\android\app\build\outputs\apk\debug\app-debug.apk

Un saludo

You should read the link I posted.
android 8.0.0 does not exist, so I wonder what you did there :wink:

But happy it worked anyway :stuck_out_tongue: