Search code examples
androidwindowsextjscmdpackaging

sencha android packaging packager.json (on windows)


getting [ERR] java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING)

Seems like a JOSN parsing error, but all tips i found aren't working. The project is perfectly builded, my packager.json looks like that:

{
   "applicationName":"firstapp",
   "applicationId":"com.parcello.firstapp",
   "versionString":"1.0",
   "iconName:":"resources\icons\Icon.png",
   "inputPath":"\",
   "outputPath":"C:\Users\mitch\Desktop\touch-2.3.0\firstapp\and\",
   "configuration":"Debug",
   "platform":"Android",
   "deviceType":"Universal",
   "certificatePath":"C:\Users\mitch\Desktop\touch-2.3.0\firstapp\release.keystore",
   "certificateAlias":"firstapp",
   "sdkPath":"C:\Users\mitch\android-sdks",
   "orientations": [
       "portrait",
       "landscapeLeft",
       "landscapeRight",
       "portraitUpsideDown"
   ]
}

and the complete error in my win command is:

[ERR] java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 9 column 26 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) at com.google.gson.Gson.fromJson(Gson.java:791) at com.google.gson.Gson.fromJson(Gson.java:757) at com.google.gson.Gson.fromJson(Gson.java:706) at com.sencha.util.JsonUtil$ThreadSafeGson.fromJson(JsonUtil.java:228) at com.sencha.util.JsonUtil.fromJson(JsonUtil.java:128) at com.sencha.tools.pkg.Model$Package.load(Model.java:651) at com.sencha.tools.pkg.LocalRepository.verifyPackage(LocalRepository.java:548) at com.sencha.tools.pkg.LocalRepository.addPackage(LocalRepository.java:351) at com.sencha.command.pkg.AddCommand.execute(AddCommand.java:28)

Any ideas, because of that the command:

sencha app build native

isn't running as well.

It's touch 2.3.0 with : http://docs-devel.sencha.com/touch/2.3.0/#!/guide/getting_started


Solution

  • The JSON you provided is invalid as you have not escaped the backslash '\' characters.

    Once '\' is changed to '\' the JSON is valid:

    {
       "applicationName":"firstapp",
       "applicationId":"com.parcello.firstapp",
       "versionString":"1.0",
       "iconName:":"resources\\icons\\Icon.png",
       "inputPath":"\\",
       "outputPath":"C:\\Users\\mitch\\Desktop\\touch-2.3.0\\firstapp\\and\\",
       "configuration":"Debug",
       "platform":"Android",
       "deviceType":"Universal",
       "certificatePath":"C:\\Users\\mitch\\Desktop\\touch-2.3.0\\firstapp\\release.keystore",
       "certificateAlias":"firstapp",
       "sdkPath":"C:\\Users\\mitch\\android-sdks",
       "orientations": [
           "portrait",
           "landscapeLeft",
           "landscapeRight",
           "portraitUpsideDown"
       ]
    }