alibaba / alibaba/fastjson2

[BUG] FastJSON2 Android依赖2.0.53版本编译不通过

Open
#3,142 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
*编译不通过*

### 环境信息
*请填写以下信息:*

- OS信息: [macOS Monterey 12.7.6]
- JDK信息: [17]
- 版本信息:[Fastjson2 2.0.53]
- AGP版本: [7.4.2]
- Kotlin版本: [1.8.20]

### 重现步骤
*如何操作可以重现该问题:*

1. Android依赖2.0.53
2. 编译
3. 出现 `FAILED` 错误

```groovy
versions.fastjson2 = '2.0.53'
ext.versions = versions

implementation("com.alibaba.fastjson2:fastjson2:${versions.fastjson2}")
implementation("com.alibaba.fastjson2:fastjson2-extension:${versions.fastjson2}")
```

### 期待的正确结果
*希望编译通过*

### 相关日志输出
```
> Task :app:dexBuilderDebug FAILED
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"/Users/wuhuannan/.gradle/caches/transforms-3/5763dc353529590d4989d38609443ca3/transformed/jetified-fastjson2-extension-2.0.53.jar"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"/Users/wuhuannan/.gradle/caches/transforms-3/e91b484264d5939860b90136a59dc7af/transformed/jetified-fastjson2-2.0.53.jar"}],"tool":"D8"}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexBuilderDebug'.
> Could not resolve all files for configuration ':app:detachedConfiguration18'.
> Failed to transform jetified-fastjson2-extension-2.0.53.jar to match attributes {artifactType=ext-dex-dexBuilderDebug, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for DexingExternalLibArtifactTransform: /Users/wuhuannan/.gradle/caches/transforms-3/5763dc353529590d4989d38609443ca3/transformed/jetified-fastjson2-extension-2.0.53.jar.
> Error while dexing.
> Failed to transform jetified-fastjson2-2.0.53.jar to match attributes {artifactType=ext-dex-dexBuilderDebug, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for DexingExternalLibArtifactTransform: /Users/wuhuannan/.gradle/caches/transforms-3/e91b484264d5939860b90136a59dc7af/transformed/jetified-fastjson2-2.0.53.jar.
> Error while dexing.

* 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

BUILD FAILED in 12s
109 actionable tasks: 15 executed, 94 up-to-date
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the FastJSON2 2.0.53 and fastjson2-extension 2.0.53 Gradle dependencies, using the reported Android, AGP, Kotlin, JDK, and macOS versions. Start with the :app:dexBuilderDebug task and its D8 error output; done means both dependencies transform successfully and the Android project compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.