美文网首页
解决android studio 打包出现Expected a

解决android studio 打包出现Expected a

作者: 安卓_背包客 | 来源:发表于2020-06-12 16:23 被阅读0次

打包是出现错误

a.png
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a name but was STRING at line 1 column 99 path $[0].apkInfo.versionName
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:187)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
    at com.google.gson.Gson.fromJson(Gson.java:805)
    at com.google.gson.Gson.fromJson(Gson.java:770)
    at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:234)
    at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:184)
    at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:140)
    at com.android.build.gradle.internal.ide.BuildOutputsSupplier.lambda$get$1(BuildOutputsSupplier.java:54)
    at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:397)
    at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:49)
    at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:34)
    at com.android.build.gradle.internal.ide.AndroidArtifactImpl.getOutputs(AndroidArtifactImpl.java:135)
    at com.android.build.gradle.internal.LintGradleProject$AppGradleProject.<init>(LintGradleProject.java:206)
    at com.android.build.gradle.internal.LintGradleProject$AppGradleProject.<init>(LintGradleProject.java:192)
    at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:948)
    at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:784)
    at com.android.build.gradle.internal.LintGradleClient.createLintRequest(LintGradleClient.java:182)
    at com.android.tools.lint.LintCliClient.run(LintCliClient.java:149)
    at com.android.build.gradle.internal.LintGradleClient.run(LintGradleClient.java:197)
    at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:198)
    at com.android.build.gradle.tasks.LintPerVariantTask.lintSingleVariant(LintPerVariantTask.java:53)
    at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 105 more
Caused by: java.lang.IllegalStateException: Expected a name but was STRING at line 1 column 99 path $[0].apkInfo.versionName
    at com.google.gson.stream.JsonReader.nextName(JsonReader.java:799)
    at com.android.build.gradle.internal.scope.BuildOutputs$ApkInfoAdapter.read(BuildOutputs.java:278)
    at com.android.build.gradle.internal.scope.BuildOutputs$ApkInfoAdapter.read(BuildOutputs.java:248)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:95)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:183)
    ... 145 more

本以为是本地json 解析错误哪,但是看了代码能正常跑起来,没问题啊
后来,删除bulid 等待都没有解决,
然后删除本地reslase文件下outjson ,突然就好的! 我**********


1591950459(1).jpg

output.json
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":16,"versionName":"2.0.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
估计as 是解析出错了,

相关文章

网友评论

      本文标题:解决android studio 打包出现Expected a

      本文链接:https://www.haomeiwen.com/subject/lxcntktx.html