Fuel: Error on get() method

Created on 25 Apr 2019  路  3Comments  路  Source: kittinunf/fuel

The same codes were working fine until the update from version 1.9.0 to 2.0.1.
Error showing at the get method and I am not sure how to solve it.

String quotesURL = "https://api.forismatic.com/api/1.0/" + "?method=getQuote&format=text&lang=en";

         Fuel.get(quotesURL).responseString(new Handler<String>() {
                    @Override
                     public void success(String quote) {
                             nameList.add(quote);
...

image
Errors:
image

  • OS: Windows 10
  • IDE: Android Studio
  • Fuel version: 2.0.1

Please help :(

Most helpful comment

Thank you! You are my savior!

It works after I put null as the second parameter and use Fuel instance!

Fuel.INSTANCE.get(quotesURL, null).responseString(new Handler<String>() { ...

All 3 comments

Try Fuel.get(quotesUrl, null). Second argument is for parameters. When you call this method from Kotlin you can omit second parameter (it is null by default) but you use Java, so must declare null explicitly.

Another (better) solution is to add annotation @JvmOverloads to method get. I think so

Thank you! You are my savior!

It works after I put null as the second parameter and use Fuel instance!

Fuel.INSTANCE.get(quotesURL, null).responseString(new Handler<String>() { ...

Glad you got it working, @kenrube is correct.

Another (better) solution is to add annotation @JvmOverloads to method get. I think so

We've removed all Interopt like that and support only Kotlin as a first-class citizen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julfc picture julfc  路  5Comments

jsyeo picture jsyeo  路  5Comments

iNoles picture iNoles  路  5Comments

fyi2 picture fyi2  路  3Comments

Jirayu4R7 picture Jirayu4R7  路  3Comments