cannot find symbol method with() using picasso library android

73,334

Solution 1

It looks like in the latest Picasso Snapshot that you are using the method with hast been renamed to get see related commit here: https://github.com/square/picasso/commit/e7e919232fe2b15772a7fcd9e15ead2304c66fae

so replace with() with get() and should work.

Since you are using a not yet officially released version, there are no release notes yet, and surprizes like that can happen ;-)

BTW: It seems to be a good name change to me, since a method named "with" but without parameter was a bit weird :-P

Solution 2

Use get() Instead of with() it will work

Picasso.get().load("image_URL").into(imageView);

with() hast been renamed to get()

Solution 3

We have to replace with() with get() and very important, now the context is not necessary for this method.

 Picasso.get().load(url).into(view);

Add into the build.gradle file the dependency described into the documentation:

implementation 'com.squareup.picasso:picasso:2.71828'

Picasso documentation.

Solution 4

In the latest Picasso library, they renamed with() into get()

So, instead of using

Picasso.with(context).load(url).placeholder(R.drawable.default_pic).into(imageView);

Use below line

Picasso.get().load(url).placeholder(R.drawable.default_pic).into(imageView);

Solution 5

you need change method with() for get()

example:

before:

Picasso.with(context).load(listaConductores.get(position).getAvatarUrl()).into(holder.imageId);

after:

Picasso.get().load(listaConductores.get(position).getAvatarUrl()).into(holder.imageId);

my dependencie:

implementation 'com.squareup.picasso:picasso:2.71828'
Share:
73,334
Afsara
Author by

Afsara

Updated on December 14, 2021

Comments

  • Afsara
    Afsara over 2 years

    i'm getting one issue in android app, I am trying to check already existing app, the app contains

     implementation('com.squareup.picasso:picasso:3.0.0-SNAPSHOT') {
            exclude group: 'com.android.support'
        }
    

    picasso library and

    using that library in a class, here is the code

    import com.squareup.picasso.Picasso;
    
        Picasso.with().load(url).placeholder(R.drawable.default_pic).into(imageView);
    

    here is the error, Error:(49, 20) error: cannot find symbol method with()

    and my android studio version is 3.0 RC1, is this is an issue ?

  • Ratilal Chopda
    Ratilal Chopda over 6 years
  • donfuxx
    donfuxx over 6 years
    Umm.. so you suggest to downgrade the picasso version, but what if the user wants to actually use the upcoming 3.x version already?
  • AskNilesh
    AskNilesh over 6 years
    @donfuxx just updating ans
  • CoolMind
    CoolMind over 6 years
    github.com/square/picasso/issues/364 recommends to update to 3.0.0-SNAPHOT.
  • ClassA
    ClassA over 5 years
    Do you know where Picasso gets the context from with the new method? It use to be with(context) and now it's get(), without passing context?
  • Sarthak Grover
    Sarthak Grover over 5 years
    Maybe the context of the image view it is loading the image in.
  • gi097
    gi097 over 5 years
    @ClassA it uses the getContext() from Android's ContentProvider, see PicassoProvider.java
  • Reeshabh Ranjan
    Reeshabh Ranjan over 5 years
    I am not able to find either get() or with(). Does it have something to do with Proguard?
  • Mickäel A.
    Mickäel A. over 4 years
    Wrong. v2.4.0 still uses Picasso.with().
  • Harsha
    Harsha over 4 years
    What happened to passing the context? Why was it not required anymore?
  • borchvm
    borchvm over 4 years
    While this code may provide a solution to the question, it's better to add context as to why/how it works. This can help future users learn, and apply that knowledge to their own code. You are also likely to have positive feedback from users in the form of upvotes, when the code is explained.
  • SMBiggs
    SMBiggs over 3 years
    Why does this work? What happened to the context? Why did they make such a big change (ie, breaking all old code)?
  • MohammadReza
    MohammadReza over 3 years
    Picasso.get() is should be work Picasso.with(context) is Deprecated