mikeorr85
mikeorr85

Reputation: 470

stripe-android lib 1.0.3 upgrade causes execution error

I upgraded to the latest stripe-android lib: compile 'com.stripe:stripe-android:1.0.3'

which only required me to add currency to the Card constructor ("USD"):

Card stripeCard = new Card(
  cardNumber, month, year, cvc, name,
  line1, line2, city, state, zip, "US", "USD"
);

But this causes an execution error in Android Studio after a successful compile:

enter image description here

The execution error goes away when I downgrade to: compile 'com.stripe:stripe-android:1.0.0'

Here's a portion of my build.gradle:

compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.website.app"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 20
    versionName "1.0"
}

Any ideas?

Upvotes: 0

Views: 130

Answers (2)

mikeorr85
mikeorr85

Reputation: 470

It looks like I reached the 65k limit for the first time. My ultimate solution was to include the specific APIs of Google Play Services that I needed instead of all of them. Read more here: https://developers.google.com/android/guides/setup

Running ./gradlew assemble --info as suggested by @Gabriele Mariotti helped give me a slightly more detailed "UNEXPECTED TOP-LEVEL DEX EXCEPTION". With that, I came across this post: Why did this happen? How do i fix this? Android: UNEXPECTED TOP-LEVEL EXCEPTION:, which directed me to this documentation https://developer.android.com/tools/building/multidex.html

Upvotes: 0

user5808934
user5808934

Reputation: 11

Currency can't be passed as a parameter to the constructor, but you can set it using the card's Builder or by setting the property explicitly, i.e.

//using the Builder
Card card = new Card.Builder("4242424242424242", 9, 2018, "123").currency("usd").build();

//or set the property once you've created the card
card.setCurrency("usd")

Upvotes: 1

Related Questions