简体   繁体   中英

Cannot resolve method 'get(java.lang.String)' after android studio gradle update, using Fuel library

I am using Fuel library to get random quotes from the forismatic api to build a simple chat bot app. It was working fine but after the android studio gradle update and changing the Fuel API dependency to the newest version, an error occurred at the get() method. I am not sure why this happened as I am using the method in the same way as Fuel documentation. I have tried searching for solutions on the internet but could not find any.

The problem is cannot resolve get(quotesURL) method. Please help me :(

The get method shows error (Cannot resolve method 'get(java.lang.String)') 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);
   imageList.add("https://openclipart.org/image/2400px/svg_to_png/238032/sakura-flower.png");
           setRecyclerView();
       }

        @Override
        public void failure(@NotNull FuelError fuelError) {
           Toast.makeText(BotActivity.this, fuelError.toString(), Toast.LENGTH_SHORT).show();
      }
   });
}

Luckily I found a solution:

https://github.com/kittinunf/fuel/issues/627

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

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