App is not working with - - prod flag build


#1

[Solved]
My bluetooth app is running well when I am building
the app with “ionic cordova build android” command. BUT when I am building my app with - - prod flag i. e “ionic cordova build android - - prod”, my app is not getting access to the BLUETOOTH SERIAL cordova plugin and throwing error.

I am using …
ionic-angular “3.7.1” ,
ionic-native/core "4.3.0"
ionic-native/bluetooth serial “4.3.2”


#2

Hello,
If no error message appears here, nothing has happened.

best regards, anna-liebt with here broken glass ball.


#3

App is not getting bluetooth access with - - prod build.Actually cordova plugin is not working. But it is running as expected with normal “ionic cordova build android”.


#4

What is your ionic info output?
What is the complete output you get when building with --prod?


#5

no problem in build


#6

Please actually read the questions I asked and answer them.

Also please don’t post screenshots but the actual text and format it in a readable way.


#7

PS C:\Users\shafi\projects\myBluetooth> ionic cordova build android --prod
Running app-scripts build: --prod --platform android --target cordova
[23:23:06] build prod started …
[23:23:06] clean started …
[23:23:06] clean finished in 6 ms
[23:23:06] copy started …
[23:23:07] deeplinks started …
[23:23:07] deeplinks finished in 62 ms
[23:23:07] ngc started …
[23:23:13] ngc finished in 6.44 s
[23:23:13] preprocess started …
[23:23:13] copy finished in 6.61 s
[23:23:13] preprocess finished in 137 ms
[23:23:13] webpack started …
[23:23:38] webpack finished in 24.84 s
[23:23:38] uglifyjs started …
[23:23:38] sass started …
[23:23:40] sass finished in 2.08 s
[23:23:40] cleancss started …
[23:23:54] cleancss finished in 14.07 s
[23:23:55] uglifyjs finished in 17.23 s
[23:23:55] postprocess started …
[23:23:55] postprocess finished in 24 ms
[23:23:55] lint started …
[23:23:55] build prod finished in 48.86 s

cordova build android
[23:23:58] lint finished in 3.10 s
ANDROID_HOME=C:\Users\shafi\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Subproject Path: CordovaLib
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_5sn6cn2gdwxwgdwo6ll0ot6nk.run(C:\Users\shafi\projects\myBluetooth\platforms\android\build.gradle:137)

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild
UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk
UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders
UP-TO-DATE

:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript

UP-TO-DATE
:CordovaLib:generateDebugResValues

UP-TO-DATE
:CordovaLib:generateDebugResources

UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE
:CordovaLib:processDebugManifest
UP-TO-DATE
:CordovaLib:generateDebugBuildConfig
UP-TO-DATE
:CordovaLib:processDebugResources

UP-TO-DATE
:CordovaLib:generateDebugSources
UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard

UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE
:CordovaLib:processDebugJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
UP-TO-DATE

:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
UP-TO-DATE

:CordovaLib:bundleDebug
UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib623DebugLibrary

UP-TO-DATE
:prepareDebugDependencies

:compileDebugAidl
UP-TO-DATE
:compileDebugRenderscript
UP-TO-DATE
:generateDebugBuildConfig

UP-TO-DATE
:generateDebugResValues
UP-TO-DATE

:generateDebugResources UP-TO-DATE
:mergeDebugResources
UP-TO-DATE
:processDebugManifest
UP-TO-DATE
:processDebugResources
UP-TO-DATE
:generateDebugSources UP-TO-DATE

:incrementalDebugJavaCompilationSafeguard
UP-TO-DATE

:compileDebugJavaWithJavac
UP-TO-DATE

:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders
UP-TO-DATE
:compileDebugShaders
UP-TO-DATE
:generateDebugAssets
UP-TO-DATE
:mergeDebugAssets
UP-TO-DATE

:transformClassesWithDexForDebug
UP-TO-DATE
:mergeDebugJniLibFolders
UP-TO-DATE

:transformNative_libsWithMergeJniLibsForDebug
UP-TO-DATE
:processDebugJavaRes
UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:validateSigningDebug
:packageDebug
UP-TO-DATE

:assembleDebug

UP-TO-DATE
:cdvBuildDebug
UP-TO-DATE

BUILD SUCCESSFUL

Total time: 3.27 secs
Built the following apk(s):
C:/Users/shafi/projects/myBluetooth/platforms/android/build/outputs/apk/android-debug.apk


#8

Ionic Info
PS C:\Users\shafi\projects\myBluetooth> ionic info

cli packages: (C:\Users\shafi\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v6.10.3
npm  : 3.10.10
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : legacy

#9

current cordova-anroid is 6.4.0
I also think there is a newer app-scripts available.


#10

I have used the latest ionic . But still the same problem with --prod flag build

PS C:\Users\shafi\projects\myProjectApp> ionic info

cli packages: (C:\Users\shafi\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 5.5.1
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Users\shafi\AppData\Local\Android\Sdk

Misc:

backend : legacy

#11

Late to the party but I found a magic set of commands that lets me build with aot (prod like)

ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer true
ionic cordova build ios --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer true