gradle - 预期为 BEGIN_ARRAY,但在生成 APK 时为第 1 行第 2 列路径 $ 的 BEGIN_OBJECT
问题描述
我的项目在 AVD 上正确运行。但是当我尝试生成签名的 APK 时,gradle 得到这个错误:
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
> Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more
log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
我已经多次使用此命令:gson.fromJson
. 但我找不到错误来源。(哪个文件和哪一行)。
那么如何找到错误的根源
解决方案
当我进行 Gradle 同步时,我在 Android Studio 4.0 中遇到了这个问题。我通过执行以下操作来修复它:
打开顶层
build.gradle
并将 gradle 类路径更改为:classpath 'com.android.tools.build:gradle:4.0.0'
打开
gradle\wrapper\gradle-wrapper.properties
并将分发 URL 更改为:distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
.idea\jarRepositories.xml
从新项目中复制
不知道如何或为什么,但它对我有用
推荐阅读
- javascript - 获取 JSON 并显示 HTML 表格
- r - 为间隔创建标签
- mediawiki - (更新)Semantic Mediawiki:有没有办法过滤查询中的子对象?
- python - 在 docker-compose 服务内的 python pika 微服务消费者中没有发生打印
- typescript - 在 Typescript 中传递 Props 以响应样式化组件
- windows - 在 Windows 10 启动时杀死进程的批处理脚本
- python - 当递归发生时,为什么这个列表会变成 NoneType?
- python - Plotting by ignoring missing data in matplotlib
- javascript - Javascript/HTML - 使用 onclick 重复功能
- javascript - '没有创建 Firebase 应用程序'[DEFAULT]''即使调用了 initializeApp