我正在将 stripe payment 集成到我的新 Android 应用中。
我从 git hub( https://github.com/stripe/stripe-android/archive/master.zip ) 下载了 stripe 库项目并将其导入 Eclipse。
之后,我将这个库项目包含在我的项目中。
当我开始在我的设备上运行该应用程序时,出现以下错误。
[2014-10-04 00:08:03 - stripe] Could not find stripe.apk!
运行后,我在 Stripe 调用中得到 Exception
。
10-04 00:16:29.106: E/AndroidRuntime(26379): java.lang.NoClassDefFoundError: com.stripe.android.model.Card
谢谢。
最佳答案
NoClassDefFoundError 表示类的定义在编译时找到,但在运行时找不到。最可能的原因是(并由您显示的日志消息重申)是 Stripe 类定义在运行时(即在您的设备中)不可用。但是您没有遇到任何编译时错误,因为该类在您的系统中构建时可用。
我检查了 Stripe github 页面,自述文件信息没有说明生成 Stripe.apk(或需要它)的任何内容。很可能你的 eclipse 导致了这个问题。我以前见过这种错误。
切换到 Android Studio 后,我没有遇到任何这些问题,因为 gradle 会自动获取依赖项并链接它们。
关于android - Android 上的 Stripe 支付集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26182813/