无法找到符号方法与()使用毕加索图书馆机器人

我得到了一个问题,在安卓应用程序,我试图检查已经存在的应用程序,应用程序包含

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

毕加索图书馆

在类中使用这个库,下面是代码

import com.squareup.picasso.Picasso;


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

这里有个错误 Error:(49, 20) error: cannot find symbol method with()

我的机器人工作室版本是3.0 RC1,这是一个问题吗?

79270 次浏览

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

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

with() hast been renamed to get()

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

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.

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);

Instead of with() :

Picasso.with().load(listdata.getImageurl()).into(img);

Use get() :

Picasso.get().load(listdata.getImageurl()).into(img);

And into the build.gradle add this :

 implementation 'com.squareup.picasso:picasso:2.4.0'

And this work for me...

* Try this line of code, if you're using Picasso library v.2.5.2 *

Picasso.with(context).load("imageUrl").into(imageView);

Add this into your build.gradle file inside dependecies

implementation 'com.squareup.picasso:picasso:2.5.2'

* Try this line of code, if you're using older version for example v.2.4.0*

Picasso.get(context).load("imageUrl").into(imageView);

Add this into your build.gradle file inside dependecies

implementation 'com.squareup.picasso:picasso:2.4.0'

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'
Picasso.with(context).load("imageUrl").into(imageView);


replace it with this below code.


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

implementation 'com.squareup.picasso:picasso:2.5.2'

add this dependency to your build.gradel file and sync.

Simply Replace with(context) to get()

also add to Gradle

implementation 'com.squareup.picasso:picasso:2.5.2'

I had to downgrade to Picasso library v.2.5.2 to avoid code debugging which worked faster and easier.


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'---> downgraded version
}
Picasso.with(MainActivity.this).load("image_URL").into(imageView);

Change this Code into ..

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

instead of using :- Picasso.get().load("image_URL").into(imageView);

u can use Picasso.with(Context).load("image_URL").into(imageView);