1

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

似乎是一个 JOSN 解析错误,但我发现的所有提示都不起作用。该项目构建完美,我的 packager.json 看起来像这样:

{
   "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"
   ]
}

我的 win 命令中的完整错误是:

[ERR] java.lang.IllegalStateException:预期的 BEGIN_OBJECT 但在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) 的第 9 行第 26 列 com.google.gson.Gson .fromJson(Gson.java:791) 在 com.google.gson.Gson.fromJson(Gson.java:757) 在 com.google.gson.Gson.fromJson(Gson.java:706) 在 com.sencha.util。 JsonUtil$ThreadSafeGson.fromJson(JsonUtil.java:228) 在 com.sencha.util.JsonUtil.fromJson(JsonUtil.java:128) 在 com.sencha.tools.pkg.Model$Package.load(Model.java:651)在 com.sencha.tools.pkg.LocalRepository.verifyPackage(LocalRepository.java:548) 在 com.sencha.tools.pkg.LocalRepository.addPackage(LocalRepository.java:351) 在 com.sencha.command.pkg.AddCommand.execute (AddCommand.java:28)

任何想法,因为这个命令:

sencha app build native

也没有运行。

这是触摸 2.3.0 与:http ://docs-devel.sencha.com/touch/2.3.0/#!/guide/getting_started

4

2 回答 2

0

您提供的 JSON 无效,因为您没有转义反斜杠 '\' 字符。

一旦 '\' 更改为 '\',JSON 就有效:

{
   "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"
   ]
}
于 2013-10-31T17:31:13.840 回答
0

尝试在您的路径中从“\”更改为“/”

"sdkPath":"D:/path_to_your_adt/adt-bundle/sdk/tools",

:-)

于 2014-08-28T12:23:20.833 回答