问题
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:
- 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
- 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.
- Your jar is not in the
/libsfolder. 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 viaant cleanor 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