Zack
February 27, 2019, 8:04am
1
Hi, I have just installed (upgraded) the latest version: 7.3.0.1 on machine A
I now get the following error when trying to build phonegap app:
The phonegap server responded in an invalid manner: No JSON object could be decoded.
I copied the project to a different machine B still with version 7.2.1.1
Build went through fine.
Must I change anything in the new version?
rgs
Zack
ghenne
February 27, 2019, 2:12pm
2
That error message usually means there is a problem in your config.xml file. You can try posting its contents into a JSON checker, such as JSON Online Validator and Formatter - JSON Lint
Zack
March 4, 2019, 10:12am
3
Hi, good day!,
My apologies for not responding sooner.
Before we continue, as I stated above, the same project with the same config.xml works perfectly in a previous version
OK, I pasted my config file into jsonlint as you suggested.
First few lines of my xml is:
< ? xml version = "1.0"
encoding = "UTF-8" ? >
<
widget
xmlns = "https://www.w3.org/ns/widgets"
xmlns: gap = "http://phonegap.com/ns/1.0"
id = "com.nsbasic.{id}"
versionCode = "1"
version = "{version}" >
jsonlint finds error:
Error: Parse error on line 1: < ? xml version = "1 ^ Expecting ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{’, ‘[’, got ‘undefined’
which makes no sense to me
ghenne
March 4, 2019, 1:19pm
4
I would expect the first few lines to look like this:
<?xml version="1.0" encoding="UTF-8"?>
<widget
xmlns = "https://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.nsbasic.{id}"
versionCode = "1"
version = "{version}">
Yours seems to have some odd spaces and returns in it.
ghenne
March 4, 2019, 3:59pm
6
Seeing that the first part of your XML file was corrupted, there could be problems elsewhere.
Did you try your corrected json in the jsonlint?
Zack
March 4, 2019, 5:09pm
7
Hi George,
Jsonlint give exactly the same error with the corrected code.
There must be some other problem.
Rgs
Zack
ghenne
March 4, 2019, 7:17pm
8
Seeing that the first part of your XML file was corrupted, there could be problems elsewhere.
Zack
March 5, 2019, 6:55am
9
Hi George,
I have now established that the problem is elsewhere and not related to the new Appstudio version. It still does however still build clean on a different machine.
Step I have taken to establish this:
I downgraded to previous version – same problem
Used the Geolocation sample – same problem
Tested both my app and the Geolocation sample’s config file in jsonlint – they both give the same error, on different machines
Any idea what else can cause such behavior?
Rgs
Zack
ghenne
March 5, 2019, 11:46am
10
Yes. I’m pretty sure it is your configxml. While you may have corrected the first few lines, I bet the rest of it has problems too.
Why not post your complete configxml?
Zack
March 6, 2019, 6:43am
11
Hi George,
Here it is;
<?xml version="1.0" encoding="UTF-8"?>
<widget
xmlns = "https://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.nsbasic.{id}"
versionCode = "1"
version = "{version}">
<name>{title}</name>
<description>{description}</description>
<preference name="phonegap-version" value="{phoneGapVersion}" />
<!-- Icons -->
<icon src='{icon}' />
<platform name = 'android'>
<icon src='icons/android/ldpi.png' platform='android' qualifier='ldpi' />
<icon src='icons/android/mdpi.png' platform='android' qualifier='mdpi' />
<icon src='icons/android/hdpi.png' platform='android' qualifier='hdpi' />
<icon src='icons/android/xhdpi.png' platform='android' qualifier='xhdpi' />
<icon src='icons/android/xxhdpi.png' platform='android' qualifier='xxhdpi' />
<preference name="android-targetSdkVersion" value="28" />
</platform>
<platform name = 'ios'>
<icon src='icons/ios/icon-40.png' platform='ios' width='40' height='40' />
<icon src='icons/ios/icon-40@2x.png' platform='ios' width='80' height='80' />
<icon src='icons/ios/icon-50.png' platform='ios' width='50' height='50' />
<icon src='icons/ios/icon-50@2x.png' platform='ios' width='100' height='100' />
<icon src='icons/ios/icon-60.png' platform='ios' width='60' height='60' />
<icon src='icons/ios/icon-60@2x.png' platform='ios' width='120' height='120' />
<icon src='icons/ios/icon-60@3x.png' platform='ios' width='180' height='180' />
<icon src='icons/ios/icon-72@.png' platform='ios' width='72' height='72' />
<icon src='icons/ios/icon-72@2x.png' platform='ios' width='144' height='144' />
<icon src='icons/ios/icon-72@3x.png' platform='ios' width='216' height='216' />
<icon src='icons/ios/icon-76.png' platform='ios' width='76' height='76' />
<icon src='icons/ios/icon-76@2x.png' platform='ios' width='152' height='152' />
<icon src='icons/ios/icon-small.png' platform='ios' width='29' height='29' />
<icon src='icons/ios/icon-small@2x.png' platform='ios' width='58' height='58' />
<icon src='icons/ios/icon.png' platform='ios' width='57' height='57' />
<icon src='icons/ios/icon@2x.png' platform='ios' width='114' height='114' />
</platform>
<!-- Splash Screens -->
<preference name='SplashScreenDelay' value='2000' />
<preference name='AutoHideSplashScreen' value='true' />
<gap:splash src='{splashscreen}'/>
<gap:plugin name='cordova-plugin-splashscreen' source='npm' />
<platform name='android'>
<splash src='splash/android/res-long-land-hdpi/splash.png' qualifier='long-land-hdpi' />
<splash src='splash/android/res-long-land-ldpi/splash.png' qualifier='long-land-ldpi' />
<splash src='splash/android/res-long-land-mdpi/splash.png' qualifier='long-land-mdpi' />
<splash src='splash/android/res-long-land-xhdpi/splash.png' qualifier='long-land-xhdpi' />
<splash src='splash/android/res-long-land-xxhdpi/splash.png' qualifier='long-land-xxhdpi' />
<splash src='splash/android/res-long-land-xxxhdpi/splash.png' qualifier='long-land-xxxhdpi' />
<splash src='splash/android/res-long-port-hdpi/splash.png' qualifier='long-port-hdpi' />
<splash src='splash/android/res-long-port-ldpi/splash.png' qualifier='long-port-ldpi' />
<splash src='splash/android/res-long-port-mdpi/splash.png' qualifier='long-port-mdpi' />
<splash src='splash/android/res-long-port-xhdpi/splash.png' qualifier='long-port-xhdpi' />
<splash src='splash/android/res-long-port-xxhdpi/splash.png' qualifier='long-port-xxhdpi' />
<splash src='splash/android/res-long-port-xxxhdpi/splash.png' qualifier='long-port-xxxhdpi' />
<splash src='splash/android/res-notlong-land-hdpi/splash.png' qualifier='notlong-land-hdpi' />
<splash src='splash/android/res-notlong-land-ldpi/splash.png' qualifier='notlong-land-ldpi' />
<splash src='splash/android/res-notlong-land-mdpi/splash.png' qualifier='notlong-land-mdpi' />
<splash src='splash/android/res-notlong-land-xhdpi/splash.png' qualifier='notlong-land-xhdpi' />
<splash src='splash/android/res-notlong-land-xxhdpi/splash.png' qualifier='notlong-land-xxhdpi' />
<splash src='splash/android/res-notlong-land-xxxhdpi/splash.png' qualifier='notlong-land-xxxhdpi' />
<splash src='splash/android/res-notlong-port-hdpi/splash.png' qualifier='notlong-port-hdpi' />
<splash src='splash/android/res-notlong-port-ldpi/splash.png' qualifier='notlong-port-ldpi' />
<splash src='splash/android/res-notlong-port-mdpi/splash.png' qualifier='notlong-port-mdpi' />
<splash src='splash/android/res-notlong-port-xhdpi/splash.png' qualifier='notlong-port-xhdpi' />
<splash src='splash/android/res-notlong-port-xxhdpi/splash.png' qualifier='notlong-port-xxhdpi' />
<splash src='splash/android/res-notlong-port-xxxhdpi/splash.png' qualifier='notlong-port-xxxhdpi' />
</platform>
<platform name = 'ios'>
<splash src='splash/ios/Default.png' width='320' height='480' />
<splash src='splash/ios/Default@2x.png' width='640' height='960' />
<splash src='splash/ios/Default-568h@2x.png' width='640' height='1136' />
<splash src='splash/ios/Default-667h@2x.png' width='750' height='1334' />
<splash src='splash/ios/Default-Portrait.png' width='768' height='1024' />
<splash src='splash/ios/Default-Landscape.png' width='1024' height='768' />
<splash src='splash/ios/Default-Portrait@2x.png' width='1536' height='2048' />
<splash src='splash/ios/Default-Landscape@2x.png' width='2048' height='1536' />
<splash src='splash/ios/Default-Portrait-736h@3x.png' width='1242' height='2208' />
<splash src='splash/ios/Default-Landscape-736h@3x.png' width='2208' height='1242' />
</platform>
<preference name="permissions" value="none"/>
<!-- sample preference specifications -->
<!-- <preference name="autorotate" value="false" readonly="true"/> -->
<!-- <preference name="orientation" value="default" /> -->
<!-- <preference name="fullscreen" value="true" /> -->
<!-- Platforms: Customize as needed. -->
<gap:platforms>
<gap:platform name="android" />
<gap:platform name="ios" />
<gap:platform name="winphone" />
</gap:platforms>
<platform name="android">
<preference name="android-targetSdkVersion" value="28" />
</platform>
<plugin name="cordova-plugin-camera" source="npm" spec="2.4.1" />
<plugin name="cordova-plugin-device" source="npm" />
<plugin name="cordova-plugin-contacts" source="npm" />
<plugin name="phonegap-plugin-barcodescanner" source="npm" spec="6.0.8"/>
<plugin name="cordova-plugin-inappbrowser" />
<plugin name="cordova-plugin-geolocation" spec="~2.4.1" />
<plugin name="cordova-plugin-statusbar" source="npm" />
<preference name="StatusBarOverlaysWebView" value="{phoneGapStatusBarOverlay}" />
<preference name="StatusBarBackgroundColor" value="{phoneGapStatusBarColor}" />
<preference name="StatusBarStyle" value="{phoneGapStatusBarStyle}" />
<plugin name="cordova-plugin-whitelist" source="npm" />
<allow-navigation href="*" />
<access origin="*" />
</widget>
Rgs
Zack
ghenne
March 6, 2019, 2:18pm
12
It looks like you have a character encoding problem - utf8 vs utf16.
Hi George,
Forgive my ignorance;
What should I do and/or change?
And remember, once again, everything is working petfectly on a different machine.
Rgs
Zack
ghenne
March 7, 2019, 2:23pm
14
There are various encoding schemes for text. Your config.xml text has ended up in a coding scheme which uses 2 bytes per character instead of the expected 1 character. This can happen by saving it on an editor with different settings.
Try moving the file from your good machine to the one with problems.
Zack,
Here’s a minimal config.xml that builds through the CLI and through Phonegap Build (it’s one I use for prototypes and to experiment with new functionality).
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
android-versionCode="1"
ios-CFBundleVersion="1"
version="0.0.1" id="com.testtube.android">
<name>TestTube</name>
<description>TestTube</description>
<author href="http://www.blank.com" email="ppetree@localhost">Blank.com</author>
<content src="index.html"></content>
<preference name="android-build-tool" value="gradle" />
<preference name="phonegap-version" value="cli-8.0.0" />
<preference name="pgb-builder-version" value="2" />
<preference name="xwalkMultipleApk" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="WebviewBounce" value="false" />
<preference name="EnableViewPortScale" value="true" />
<!-- below requires the splash screen plugin -->
<!-- docs: https://github.com/apache/cordova-plugin-splashscreen -->
<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="FadeSplashScreen" value="false" />
<preference name="FadeSplashScreenDuration" value="2" />
<preference name="ShowSplashScreenSpinner" value="false" />
<platform name="ios">
<!-- below requires the status bar plugin -->
<!-- docs: https://github.com/apache/cordova-plugin-statusbar -->
<!-- see http://devgirl.org/2014/07/31/phonegap-developers-guid -->
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="exit-on-suspend" value="false" />
<preference name="deployment-target" value="9.0" />
<preference name="ios-configuration" value="adhoc" />
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="all" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<access origin="*" />
<icon platform="ios" src="package-assets/Icon-App-29x29@1x.png" width="29" height="29" />
<icon platform="ios" src="package-assets/Icon-App-29x29@2x.png" width="58" height="58" />
<icon platform="ios" src="package-assets/Icon-App-29x29@3x.png" width="87" height="87" />
<icon platform="ios" src="package-assets/Icon-App-60x60@1x.png" width="60" height="60" />
<icon platform="ios" src="package-assets/Icon-App-60x60@2x.png" width="120" height="120" />
<icon platform="ios" src="package-assets/Icon-App-60x60@3x.png" width="180" height="180" />
<icon platform="ios" src="package-assets/Icon-App-76x76@1x.png" width="76" height="76" />
<icon platform="ios" src="package-assets/Icon-App-76x76@2x.png" width="152" height="152" />
<icon platform="ios" src="package-assets/Icon-App-40x40@1x.png" width="40" height="40" />
<icon platform="ios" src="package-assets/Icon-App-40x40@2x.png" width="80" height="80" />
<icon platform="ios" src="package-assets/Icon-App-57x57@1x.png" width="57" height="57" />
<icon platform="ios" src="package-assets/Icon-App-57x57@2x.png" width="114" height="114" />
<icon platform="ios" src="package-assets/Icon-App-72x72@1x.png" width="72" height="72" />
<icon platform="ios" src="package-assets/Icon-App-72x72@2x.png" width="144" height="144" />
<icon platform="ios" src="package-assets/Icon-Small-50x50@1x.png" width="50" height="50" />
<icon platform="ios" src="package-assets/Icon-Small-50x50@2x.png" width="100" height="100" />
<icon platform="ios" src="package-assets/Icon-App-83.5x83.5@2x.png" width="167" height="167" />
<splash platform="ios" src="package-assets/splash_320x480.png" width="320" height="480" orientation="portrait" />
<splash platform="ios" src="package-assets/splash_640x960.png" width="640" height="960" orientation="portrait" />
<splash platform="ios" src="package-assets/splash_640x1136.png" orientation="portrait" height="1136" width="640" />
<splash platform="ios" src="package-assets/splash_768x1024.png" orientation="portrait" height="1024" width="768" />
<splash platform="ios" src="package-assets/splash_1536x2048.png" orientation="portrait" height="2048" width="1536" />
<splash platform="ios" src="package-assets/splash_2048x2732.png" orientation="portrait" height="2732" width="2048" />
<splash platform="ios" src="package-assets/splash_1242x2208.png" orientation="portrait" height="2208" width="1242" />
<splash platform="ios" src="package-assets/splash_750x1334.png" orientation="portrait" height="1334" width="750" />
<splash platform="ios" src="package-assets/splash_1024x768.png" orientation="landscape" height="768" width="1024" />
<splash platform="ios" src="package-assets/splash_2048x1536.png" orientation="landscape" height="1536" width="2048" />
<splash platform="ios" src="package-assets/splash_2208x1242.png" orientation="landscape" height="1242" width="2208" />
<splash platform="ios" src="package-assets/splash_1334x750.png" orientation="landscape" height="750" width="1334" />
<splash platform="ios" src="package-assets/splash_2732x2048.png" orientation="landscape" height="2048" width="2732" />
</platform>
<platform name="android">
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="23" />
<preference name="android-installLocation" value="auto" />
<preference name="android-multiDexEnabled" value="true" />
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="portrait" />
<preference name="android-signed" value="true" />
<preference name="AndroidLaunchMode" value="singleTop" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="market:*" />
<access origin="*" />
<icon platform="android" src="package-assets/ic_ldpi.png" density="ldpi" width="36" height="36" />
<icon platform="android" src="package-assets/ic_mdpi.png" density="mdpi" width="48" height="48" />
<icon platform="android" src="package-assets/ic_hdpi.png" density="hdpi" width="72" height="72" />
<icon platform="android" src="package-assets/ic_xhdpi.png" density="xhdpi" width="96" height="96" />
<splash platform="android" src="package-assets/splash_320x426.png" density="ldpi" width="320" height="426" orientation="portrait" />
<splash platform="android" src="package-assets/splash_320x470.png" density="mdpi" width="320" height="470" orientation="portrait" />
<splash platform="android" src="package-assets/splash_480x640.png" density="hdpi" width="480" height="640" orientation="portrait" />
<splash platform="android" src="package-assets/splash_720x960.png" density="xhdpi" width="720" height="960" orientation="portrait" />
<splash platform="android" src="package-assets/splash_426x320.png" orientation="landscape" height="320" width="426" density="ldpi" />
<splash platform="android" src="package-assets/splash_470x320.png" orientation="landscape" height="320" width="470" density="mdpi" />
<splash platform="android" src="package-assets/splash_640x480.png" orientation="landscape" height="480" width="640" density="hdpi" />
<splash platform="android" src="package-assets/splash_960x720.png" orientation="landscape" height="720" width="960" density="xhdpi" />
</platform>
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-compat" spec="1.2.0" />
<plugin name="cordova.plugins.diagnostic" spec="4.0.10" />
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<plugin name="cordova-open-native-settings" spec="~1.5" />
<plugin name="cordova-plugin-vibration" spec="3.1.0" />
<plugin name="cordova-plugin-email-composer" source="npm" spec="~0.8.15" />
<plugin name="cordova-plugin-contacts" spec="^3.0.1">
<variable name="CONTACTS_USAGE_DESCRIPTION" value="We do not collect or store information on any of your contacts." />
</plugin>
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.0" />
<plugin name="es6-promise-plugin" spec="^4.2.0" />
</widget>
BTW, I don’t know why the emails put all the line breaks in the code section but blank lines are NOT allowed in config.xml files and will produce a “malformed xml” error.
Zack
March 8, 2019, 7:18am
17
Thank you very much for everyone’s assistance and help.
Nothing makes a difference.
I am now convinced that something in my development environment(machine) must have changed that is causing the problem.
As a test, I copied the entire project onto a memory stick.
I then first ran AppStudio directly from the memory stick on the working machine and the build to phonegap works perfectly.
I then ran the project on the problem machine also directly from the memory stick and the same JSON error occurs.
I have then also loaded the sample geolocation program and even this gives the same error.
This then obviously means in my mind that the problem is within the environment and I have no idea where to start.
rgs
Zack
Virus Scan
Uninstall & reinstall app studio
FWIW, I once installed VS (to replace the now defunct XDK) and, when I imported the project, it corrupted my image files and everything in my tool chain barfed. Took a week to figure out the problem.
system
Closed
March 18, 2019, 1:30pm
19
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.