我尝试使用Fuel JSON deserializer,所以我将它添加到我的依赖项中,如下所示:
implementation 'com.github.kittinunf.fuel:fuel:2.2.1'
implementation 'com.github.kittinunf.fuel:fuel-json:2.2.1'但是,每次运行./gradlew clean build时,我都会收到以下错误:
> Task :compileKotlin FAILED
e: /DirToMyClass/MyClass.kt: (55, 26): Cannot access class 'org.json.JSONObject'. Check your module classpath for missing or conflicting dependencies我已经运行./gradlew dependencies来检查是否没有其他依赖项导入org.json,并且唯一的依赖项是fuel-json。
+--- com.github.kittinunf.fuel:fuel-json:2.2.1
| +--- com.github.kittinunf.fuel:fuel:2.2.1 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50 -> 1.3.60 (*)
| \--- org.json:json:20180813我能遗漏什么呢?
发布于 2019-12-13 19:16:12
我已经通过将依赖项更改为:
implementation 'com.github.kittinunf.fuel:fuel:2.2.1'
implementation('com.github.kittinunf.fuel:fuel-json:2.2.1') {
exclude group: 'org.json', module: 'json'
}
implementation 'org.json:json:20190722'使用较新版本的org.json:json。
https://stackoverflow.com/questions/59321471
复制相似问题