Squareup Picasso.with() 方法未解决 Android Studio

Squareup Picasso.with() method unresolved Android Studio

我正在开发一个 Android 练习应用程序,它使用天气 API 并在屏幕上显示当前天气数据。它应该使用 Picasso 在 ImageView 元素上显示当前天气状态的天气图标。但是,Android Studio 无法解析 .with() 方法,尽管它可以识别 Picasso。我将 Picasso 添加到我的依赖项中,并且还在 class.

中添加了 Picasso 的导入

代码部分的屏幕截图 - .with() 为红色,因为它尚未解决

我不会添加整个 class 的代码,因为它有点大而且可能会造成混淆所以这里是我引用 Picasso 的函数的完整代码:

@Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
        if(s.contains("Error: Not found city")){
            pd.dismiss();
            return;
        }
        Gson gson = new Gson();
        Type mType = new TypeToken<OpenWeatherMap>(){}.getType();
        openWeatherMap = gson.fromJson(s, mType);
        pd.dismiss();

        txtCity.setText(String.format("%s,%s", openWeatherMap.getName(),openWeatherMap.getSys().getCountry()));

        txtLastUpdate.setText(String.format("Last Updated: %s", Common.getDateNow()));

        txtDescription.setText(String.format("%s", openWeatherMap.getWeatherList().get(0).getDescription()));

        txtHumidity.setText(String.format("%d%%", openWeatherMap.getMain().getHumidity()));

        txtTime.setText(String.format("%s/%s", Common.unixTimeStampToDateTime(openWeatherMap.getSys().getSunrise()), Common.unixTimeStampToDateTime(openWeatherMap.getSys().getSunset())));

        txtCelsius.setText(String.format("%.2f °C", openWeatherMap.getMain().getTemp()));

        Picasso.with(MainActivity.this)
                .load(Common.getImage(openWeatherMap.getWeatherList().get(0).getIcon()))
                .into(imageView);

    }

我正在使用 Android Studio V3.0.1、Android API 26 和 Picasso V2.71828。提前致谢。干杯!

像这样使用:

Picasso.get().load(Common.getImage(openWeatherMap.getWeatherList().get(0).getIcon()))
                        .into(imageView);