gpt4 book ai didi

java.lang.NoSuchMethodError : No static method with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso;

转载 作者:行者123 更新时间:2023-11-30 01:59:59 32 4
gpt4 key购买 nike

我认为这是一个库兼容性问题,但值得一试。

我正在尝试在我的应用程序中实现图像 slider ,但 Picasso 库出现了异常,它给了我 noSuchMethodError

好吧,我连接两个字符串,一个是 slider 上显示的名称,另一个是 Activity 类型,然后我放入 HashMap 和键分割键并加载到 .image 中。

 for (String key : image_list.keySet()   ) {

String[] keySplit = key.split("@@@");
String nameOfDeal = keySplit[0];
String typeOfActivity = keySplit[1];

当我记录 nameOfDeal 时,image_list.get(key) 的格式正确。有任何想法吗?下面是我的代码。

我初始化了一个SliderLayout

 //Create TextSlider
final TextSliderView textSliderView = new TextSliderView(getBaseContext());
textSliderView.description(nameOfDeal)
.image(image_list.get(key))
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(new
BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider)
{

Intent intent = new Intent(MainActivity.this, main_intermediate.class);

intent.putExtras(textSliderView.getBundle());
startActivity(intent);
}
});

textSliderView.bundle(new Bundle());
textSliderView.getBundle().putString("uniqueID",typeOfActivity);
mSlider.addSlider(textSliderView);

我的日志

11-08 20:51:01.456 1575-1575/com.example.karam.nlcg E/AndroidRuntime: FATAL 
EXCEPTION: main
Process: com.example.karam.nlcg, PID: 1575
java.lang.NoSuchMethodError: No static method
with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso; in class
Lcom/squareup/picasso/Picasso; or its super classes (declaration of
'com.squareup.picasso.Picasso' appears in /data/app/com.example.karam.nlcg-
hOIyNfHuyD9O29FGhzu4EQ==/split_lib_dependencies_apk.apk)
at com.daimajia.slider.library.
SliderTypes.BaseSliderView.bindEventAndShow(BaseSliderView.java:210)
at com.daimajia.slider.library.'
SliderTypes.TextSliderView.getView(TextSliderView.java:25)
at com.daimajia.slider.library.
SliderAdapter.instantiateItem(SliderAdapter.java:81)
at com.daimajia.slider.library.
Tricks.InfinitePagerAdapter.instantiateItem(InfinitePagerAdapter.java:54)
at com.daimajia.slider.library.Tricks
.ViewPagerEx.addNewItem(ViewPagerEx.java:848)
at com.daimajia.slider.library.Tricks.
ViewPagerEx.populate(ViewPagerEx.java:998)
at com.daimajia.slider.library.Tricks.
ViewPagerEx.setCurrentItemInternal(ViewPagerEx.java:562)
at c

om.daimajia.slider.library.Tricks.
ViewPagerEx.setCurrentItemInternal(ViewPagerEx.java:526)
at com.daimajia.slider.library.Tricks.ViewPagerEx.
setCurrentItem(ViewPagerEx.java:507)
at

com.daimajia.slider.library.Indicators.
PagerIndicator$1.onChanged(PagerIndicator.java:411)
at android.database.DataSetObservable.notifyChanged
(DataSetObservable.java:37)
at

android.support.v4.view.PagerAdapter.
notifyDataSetChanged(PagerAdapter.java:293)
at
com.daimajia.slider.library.SliderAdapter.addSlider(SliderAdapter.java:28)
at
com.daimajia.slider.library.SliderLayout.addSlider(SliderLayout.java:237)
at
com.example.karam.nlcg.MainActivity$3.onDataChange(MainActivity.java:292)
at com.google.firebase.database.core.ValueEventRegistration.
fireEvent(com.google.firebase:firebase-database@@16.0.4:75)
at com.google.firebase.database.core.view.DataEvent.fire
(com.google.firebase:firebase-database@@16.0.4:63)
at


com.google.firebase.database.core.view.EventRaiser$1
.run(com.google.firebase:fir
ebase-database@@16.0.4:55)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

最佳答案

当我开发com.daimajia.slider.library时,我发现这是实际问题他们在库中使用了 com.squareup.picasso,但 com.daimajia.slider.library 开发人员在 version 1.1.5@aar 后停止更新因此这个库需要旧版本的com.squareup.picasso

因此,您无法将 com.daimajia.slider.library 与最新的 (2.71828) 一起使用 com.squareup.picasso (如果您同时使用这两个库),您可以将 picasso 2.3.2 或 2.5.2daimajia 库一起使用,不会出现任何问题。

关于java.lang.NoSuchMethodError : No static method with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53214417/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com