Error while buildind apk

When runnin ionic cordova build android --prod --release everything is ok but when it gets to cordova build android then i have a error message:

E:\PROJETS\ionic3\appli_cdp_v3>ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[23:59:16] build prod started …
[23:59:18] clean started …
[23:59:18] clean finished in 114 ms
[23:59:18] copy started …
[23:59:18] ngc started …
[00:00:53] ngc finished in 95.78 s
[00:00:53] preprocess started …
[00:00:53] deeplinks started …
[00:01:01] deeplinks finished in 7.13 s
[00:01:01] optimization started …
[00:01:05] copy finished in 107.14 s
[00:02:32] optimization finished in 91.22 s
[00:02:32] preprocess finished in 98.38 s
[00:02:32] webpack started …
[00:08:56] webpack finished in 384.49 s
[00:08:56] sass started …
[00:08:56] uglifyjs started …
[00:09:04] sass finished in 7.71 s
[00:09:04] cleancss started …
[00:09:16] cleancss finished in 12.15 s
[00:11:10] uglifyjs finished in 134.06 s
[00:11:10] postprocess started …
[00:11:11] removed unused font files
[00:11:11] postprocess finished in 171 ms
[00:11:11] lint started …
[00:11:11] build prod finished in 714.66 s

cordova build android --release
(node:8520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token in JSON at position 0
cordova-android-play-services-gradle-release PLAY_SERVICES_VERSION: +
cordova-android-play-services-gradle-release : WROTE E:\PROJETS\ionic3\appli_cdp_v3\platforms\android\build.gradle > +

[00:11:44] lint finished in 33.20 s

I would like to know if someone had the same problem and if

cordova-android-play-services-gradle-release PLAY_SERVICES_VERSION: +
cordova-android-play-services-gradle-release : WROTE E:\PROJETS\ionic3\appli_cdp_v3\platforms\android\build.gradle > +

are aslo part of the problem or if it’s normal?
No one on the web seems to have the same error message so if someone could give me some advices to understand what is going on, i would be grateful!

thanks in advance!

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

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 1.3.7
Cordova Platforms  : android 6.4.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.1.1


Node : v6.10.2
npm  : 5.7.1
OS   : Windows 7

have you used push plugin in your app ?

yes there are a lot of cordova plugins:
android play services gradle release
device orientation



to be honest, i just join the company and the guy who was in charge of the app is not here anymore. I don’t know how ionic and angular work. I hope that the list above is what you asked for?

thank you very much for trying to help me! i really need help!

Seems like you are using some plugins(like Admob or Admob-Sdk) which has defined the GoodPlayServiceVersion. but the gradle file can’t find where is the variable defined.

A rude work around is to hard-code the version instead of using variable.

as far as i can understand the app architecture, thre’s no abmob plugin in the app.
I change the playservice version in config.xml (change to ‘11.+’) and the “after” and “before” js scripts from cordova-android-play-services-gradle-release do find the version correctly.

cordova-android-play-services-gradle-release PLAY_SERVICES_VERSION: 11.+
before : cordova-android-play-services-gradle-release : WROTE E:\PROJETS\ionic3\appli_cdp_v3\platforms\android\cordova-android-play-services-gradle-release\properties.gradle > 11.+
after : cordova-android-play-services-gradle-release : WROTE E:\PROJETS\ionic3\appli_cdp_v3\platforms\android\build.gradle > 11.+

these messages don’t occur after error catching so they seem to be ok!

i don’t really understand what the problem is. i don’t understand why it’s telling me that a json file (which one???) has a wrong first character!!

thank you very much for the hint, help and time you spent answering me!