2017-04-09 26 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()方法進行檢索。」

相關問題