Paypal Mobile Express Checkout Library sample app gives me NoClassDefFoundError Exception

二次信任 提交于 2020-01-04 12:47:52

问题


I'm testing the sample app for Mobile Express Checkout Library with Android.

I'm getting java.lang.NoClassDefFoundError: com.paypal.android.pizza.ResultDelegate

The error is on this Pizza.java line: PayPal.fetchDeviceReferenceTokenWithAppID(this, appID, server, new ResultDelegate());

I'm confused, i didnt find any info about that error on google, and also on the faq on paypal and x.com, so i don't know how to solve it.

I simply opened the sample code project and executed it.

This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip


回答1:


There are only three reasons you will ever get this error:

  1. The class genuinely doesn't exist. If you are using code from an official example and getting this, make sure you have the latest build of the library
  2. You have not added the jar to your build path. To fix this, right click on the jar in Eclipse, and do Build Path ► Add to Build Path.
  3. Your jar is not in the /libs folder. This happens when you have added the jar to the build path, but newer versions of ADT need it to be in /libs. Put it there and it will automatically be added to the build path. If it isn't, try doing a Clean build via ant clean or Project ► Clean in eclipse.

Mostly, such errors occur because newer versions of the ADT require all external jars to be in the libs folder.

By looking at the project you linked to, I can see the paypal jar in the project root. Instead, try moving it into a /libs folder. This should solve your problem.




回答2:


I think you have not exported library jar from the configure build path section of eclipse.




回答3:


create libs directory in project's directory and add move PayPal_MECL.jar to /libs. goto project properties and remove existing PayPal_MECL entry from libraries



来源:https://stackoverflow.com/questions/13120186/paypal-mobile-express-checkout-library-sample-app-gives-me-noclassdeffounderror

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