简体   繁体   中英

Unresolved reference: github, when trying to import Fuel library in Kotlin

I am new to Kotlin so apologies if I am missing something simple here.

I am trying to import the Fuel libraries into my project, I have added the below into my Gradle which appears to sync fine

implementation 'com.github.kittinunf.fuel:fuel:<latest-version>'
implementation 'com.github.kittinunf.fuel:<package>:<latest-version>'

However, when I try to import this into my activity as below:

import com.github.kittinunf.fuel.httpGet
import com.github.kittinunf.result.Result

'github' becomes highlighted in red, and the error below is shown:

Unresolved reference: github

As such I am unable to access the library, just wondering if I am missing something here in order to get this to work? I have been able to import other libraries into my project successfully, so wondering if it is something specific to this implementation I am missing. Hoping somebody could kindly assist.

I hope you are not using the dependencies you mentioned with the <latest-version> or <package> tags. These are meant to be replaced with actual version numbers/packages of the artifact, like this:

implementation "com.github.kittinunf.fuel:fuel:2.3.1"
implementation "com.github.kittinunf.fuel:fuel-coroutines:2.3.1"

If you don't have this issue, then I would recommend invalidating Gradle caches , restarting your IDE, and building from scratch for one more time. You can do that via the CLI too:

$ ./gradlew build

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