androidkotlinfuel

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.


Solution

  • 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