java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso

荒凉一梦 提交于 2019-12-24 03:32:48

问题


I try to use Picasso for the first time

like in the official site example:

private void setItemBgImageUsingPicasso(View convertView) {
    String imageUrl = getImageUrlFromOffer(convertView);

    ImageView offerImage = ((ImageView) convertView
            .findViewById(R.id.offerImage));
    Picasso.with(mOffersListActivity).load(imageUrl).into(offerImage);
}

but I get this error:

08-09 17:37:43.309: E/AndroidRuntime(17821): java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso
08-09 17:37:43.309: E/AndroidRuntime(17821):    at com.zoomer.general.ImageAdapter.setItemBgImageUsingPicasso(ImageAdapter.java:384)

回答1:


You should put it in libs folder and Eclipse will pack it properly for you.

Or you leave it as it is, but go to project properties, Export tab and check the library. This way Eclipse will pack it in the final APK.




回答2:


if using Android Studio, I found the problem to be related to proguard so, the following fixed the issue:

1) Add this to your proguard-rules file: -keep class com.squareup.picasso.** { *; }

2) Clean the project

3) Re-build



来源:https://stackoverflow.com/questions/25225327/java-lang-noclassdeffounderror-com-squareup-picasso-picasso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!