简体   繁体   中英

How to make Kotlin Fuel json serializer to compile?

I'm trying to use Fuel JSON deserializer so I added it to my dependencies like this:

implementation 'com.github.kittinunf.fuel:fuel:2.2.1'
implementation 'com.github.kittinunf.fuel:fuel-json:2.2.1'

However each time I'm running ./gradlew clean build I'm getting this error:

> Task :compileKotlin FAILED
e: /DirToMyClass/MyClass.kt: (55, 26): Cannot access class 'org.json.JSONObject'. Check your module classpath for missing or conflicting dependencies

I've run ./gradlew dependencies to check that there are no other dependency importing org.json and the only one is 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

What can I be missing?

I've fixed this by changing the dependencies to:

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'

Using a newer version of org.json:json .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM