cannot find symbol method with() using picasso library android
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'
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'
Afsara
Updated on December 14, 2021Comments
-
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 over 6 years
-
donfuxx over 6 yearsUmm.. so you suggest to downgrade the picasso version, but what if the user wants to actually use the upcoming 3.x version already?
-
AskNilesh over 6 years@donfuxx just updating ans
-
CoolMind over 6 yearsgithub.com/square/picasso/issues/364 recommends to update to 3.0.0-SNAPHOT.
-
ClassA over 5 yearsDo you know where
Picasso
gets the context from with the new method? It use to bewith(context)
and now it'sget()
, without passing context? -
Sarthak Grover over 5 yearsMaybe the context of the image view it is loading the image in.
-
gi097 over 5 years@ClassA it uses the
getContext()
from Android'sContentProvider
, seePicassoProvider.java
-
Reeshabh Ranjan over 5 yearsI am not able to find either
get()
orwith()
. Does it have something to do with Proguard? -
Mickäel A. over 4 yearsWrong. v2.4.0 still uses
Picasso.with()
. -
Harsha over 4 yearsWhat happened to passing the context? Why was it not required anymore?
-
borchvm over 4 yearsWhile 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 over 3 yearsWhy does this work? What happened to the context? Why did they make such a big change (ie, breaking all old code)?
-
MohammadReza over 3 yearsPicasso.get() is should be work Picasso.with(context) is Deprecated