enter image description herewhen i run this code in the oncreate method :

Picasso.with(this).load("http://i.imgur.com/DvpvklR.png").into(image);

I got these errors:

  • 03-11 20:02:47.240: E/AndroidRuntime(1577): FATAL EXCEPTION: main
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at com.example.news.MainActivity.onCreate(MainActivity.java:45)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.os.Handler.dispatchMessage(Handler.java:99)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.os.Looper.loop(Looper.java:123)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at android.app.ActivityThread.main(ActivityThread.java:3683)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at java.lang.reflect.Method.invokeNative(Native Method)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at java.lang.reflect.Method.invoke(Method.java:507)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  • 03-11 20:02:47.240: E/AndroidRuntime(1577): at dalvik.system.NativeStart.main(Native Method)

please help me !

有帮助吗?

解决方案

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

Either 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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top