Add proguard-rules.pro file for live Payment Key
In FoodZone and Grocers we have used Stripe, Paypal and RazorPay payment gateways for online transaction. For each payment we have used sandbox key for testing transactions.
Payment live key is sensitive data to we can not ask or we can not add any live key. For adding live key you must have to add proguard-rules.pro file at android side. without this file it might be possible that the app will not work or crashed on release build. For this you must have to follow bellow steps.
Step 1 : Create file
make a file name of proguard-rules.pro inside android>app that should be : android/app/proguard-rules.pro then paste below code inside proguard-rules.pro file
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/*
-keepclasseswithmembers class * {
public void onPayment*(...);
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
# -keep class com.google.firebase.** { *; } // uncomment this if you are using firebase in the project
-dontwarn io.flutter.embedding.**
-ignorewarnings
}
Step 2: Assign that file to build.gredle
go to android>app>build.gradle and find buildTypes inside buildTypes>release add some lines
buildTypes {
release {
// 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
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Last updated
Was this helpful?