Stripe Integration in Android Studio

Since this is a top hit on Google search for 'How to integrate Stripe to Android Studio' and since Android studio removed the import module this is how I solved the import.

  • Right click on the project and select > New > Module
  • In your directories copy contents under Stripe > Stripe folder to the module folder (You should see a newly created folder. Delete the contents of this new folder and paste the contents of Stripe > Stripe)
  • Back to Android Studio navigate to build.gradle under src add compile project(":stripe") under dependencies.
  • Refresh your gradle.

EDIT 1 Since posting this answer some changes have happened. If you would wish to add stripe into your project do so via Maven. Just add this line to your app's build.gradle inside the dependencies section:

compile 'com.stripe:stripe-android:2.0.2'

EDIT 2 It's now implementation and not compile.

implementation 'com.stripe:stripe-android:6.1.2'

You can get more details here : https://stripe.com/docs/mobile/android


Okay, so I believe what's happening is that you don't have access to the proper Card() constructor because you haven't set things up properly.

  1. Go to the github page and download the link [for the library]https://github.com/stripe/stripe-android. Unpack that folder and keep it handy.

  2. Now, go into android studio and hit 'import module'. Navigate into that stripe-android directory that you just unzipped, and hit okay. Make sure you only have 'stripe' checked when importing, and not 'example' (only 'example' will be checked by default: fix this.)

  3. Copy the jarfile stripe-java-1.12.0.jar to the directory :libs in your project (where you'd have other libraries). That jarfile should show up under the new 'stripe' directory in android studio.

  4. Go into your src directory and find your app's build.gradle. You're going to want to add, under dependencies:

    compile project(":stripe")

You may run into an error at some point saying that you need a newer version of build tools to build the project. If that's so, just start rummaging through the gradle files and changing numbers until it builds. That's what I do, at least.

Hope this helps!

(p.s: remember to include com.stripe.android.* and not com.stripe.*!)

Edit: Just ran into a new problem, and it turns out you should skip step 3. It'll cause dex to freak out that the same class is being defined in the same jarfile twice. So don't do it.


If you're not using Gradle then below is how I got it to work:

  1. Download the zip from the stripe GitHub (stripe-android-master)
  2. Import JUST the stripe folder as a module into your project. You shouldn't have to do anything fancy here.
  3. It added to my project as "main". Go into Project Structure -> modules and add "main" as a module dependency to your working module
  4. Click on the "main" (stripe) module and click the "Export" checkbox on the lib so that your working module has access to it
  5. ????
  6. Profit