2017-04-09 31 views
-1

我在我的Android应用程序上实现了条纹支付一切工作正常。但是我在创建令牌时出现错误这是部分我得到的错误有谁知道为什么我在条纹支付上得到java.lang.String

Stripe stripe =new Stripe (PUBLISHABLE_KEY); 

我得到的错误是Stripe (android.content.context) in Stripe cannot be applied java.Lang.String.PUBLISHABLE_KEY任何人能向我解释这里发生了什么,我怎么能解决这个问题。我的编译依赖是

compile 'com.stripe:stripe-java:3.10.1' 
compile 'com.stripe:stripe-android:+' 
+0

https://stripe.com/docs/mobile/android#creating-tokens-custom – cubrr

回答

1

那就是你,如果你尝试调用同类型不正确的参数的构造标准的Java编译错误之一。这就是你在这里做的。

Stripe documentation说明如何获取Stripe对象。

总之,您需要提供一个Context参数;例如

Stripe stripe = new Stripe(someContext, PUBLISHABLE_KEY); 

和文档这样说:

“[A Context]可以是要在其中操作ActivityFragment,或可以从任何View经由View#getContext()方法进行检索。”

相关问题