Skip to content

Commit

Permalink
doc: #1546 add proguard rules for push provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Remon committed Dec 18, 2023
1 parent ab2088c commit b6742c0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ This plugin requires several changes to be able to work on Android devices. Plea
4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16)
5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6)
6. Using `FlutterFragmentActivity` instead of `FlutterActivity` in `MainActivity.kt`: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/app/src/main/kotlin/com/flutter/stripe/example/MainActivity.kt#L6)
7. Rebuild the app, as the above changes don't update with hot reload
7. Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro)
```proguard
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g

Check warning on line 57 in README.md

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args

Check warning on line 58 in README.md

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error

Check warning on line 59 in README.md

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter

Check warning on line 60 in README.md

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

Check warning on line 61 in README.md

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
```
8. Rebuild the app, as the above changes don't update with hot reload

These changes are needed because the Android Stripe SDK requires the use of the AppCompat theme for their UI components and the Support Fragment Manager for the Payment Sheets

If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support
If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support.

#### iOS

Expand Down
26 changes: 23 additions & 3 deletions docs/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ You can check if your backend is communicating with the live environment at the
"livemode": true,
"next_action": null,
"status": "succeeded",
...
}
```

#### Client side
Expand Down Expand Up @@ -157,16 +157,19 @@ The payment intent should be linked to a customer and for the customer an epheme


```json

{
"id": "pi_12345",
"object": "payment_intent",
....
"charges": {
"object": "list",
"data": [
{
"id": "ch_1234",
"customer": "cus_12345",
}
]
},
}
```

#### Client-side
Expand All @@ -184,4 +187,21 @@ The payment intent should be linked to a customer and for the customer an epheme
customerEphemeralKeySecret: data['ephemeralKey'],
// Extra params
```
#### Android compile issue app bundle
When you get this issue when building android app bundle.

```bash
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider))
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error (referenced from: void com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy$createActivityEventListener$listener$1.onActivityResult(android.app.Activity, int, int, android.content.Intent))
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider))
Missing class com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider) and 1 other context)
```

Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro)
```proguard
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g

Check warning on line 202 in docs/troubleshooting.mdx

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args

Check warning on line 203 in docs/troubleshooting.mdx

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error

Check warning on line 204 in docs/troubleshooting.mdx

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter

Check warning on line 205 in docs/troubleshooting.mdx

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

Check warning on line 206 in docs/troubleshooting.mdx

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
```
5 changes: 4 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace 'com.flutter.stripe.example'
compileSdk 33
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -53,6 +53,9 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug

proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

}
}
}
Expand Down
5 changes: 5 additions & 0 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g

Check warning on line 1 in example/android/app/proguard-rules.pro

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args

Check warning on line 2 in example/android/app/proguard-rules.pro

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error

Check warning on line 3 in example/android/app/proguard-rules.pro

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter

Check warning on line 4 in example/android/app/proguard-rules.pro

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

Check warning on line 5 in example/android/app/proguard-rules.pro

View workflow job for this annotation

GitHub Actions / Typo CI

dontwarn

"dontwarn" is a typo. Did you mean "frontward"?

0 comments on commit b6742c0

Please sign in to comment.