【发布时间】:2018-08-15 14:31:59
【问题描述】:
我正在尝试使用 volley 和 gson 做一个小例子。我在 gradle 文件中有以下发布的依赖项。但是当我制作构建项目时,我收到了 发布错误。
你能告诉我如何解决它
错误:
Error:com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use
JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use
JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
分级
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'dev.dworks.libs:volleyplus:0.1.4'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.android.support:support-v4:25.0.+'
}
【问题讨论】:
-
它读取
use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1...这意味着,输入可能包含除 JSON 之外的任何内容。除非发布 JSON,否则这个问题只是推测性的。 -
我没有看到你在
build.gradle文件中导入gson库。所以先检查一下。 -
@orzangleli 我只是忘记将 gson 的依赖项添加到问题中..现在我更新了问题..请看看..无论如何我有同样的错误
-
@LetsamrIt 我想看看你是怎么用
gson的。
标签: android android-layout gson android-volley