Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In release mode, the checkout page is not working. and in console i'm getting this error. Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function #411

Open
bala-slaylewks opened this issue Sep 11, 2024 · 8 comments

Comments

@bala-slaylewks
Copy link

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

from my app when I click on the checkout button, it navigates to razorpay page where I can see the razorpay logo loads and white screen appears out of nowhere. the app crashes there.

Flutter Version :

3.24.1

Xcode Version :

Version 15.4 (15F31d)

Cocoapod Version :

Go to iOS folder > open podfile.lock > copy the razorpay-pod version and razorpay_fluttera version.
razorpay-pod (1.3.10)
razorpay_flutter (1.1.10)

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Click on checkout button from my app and it navigates to razorpay UI
  2. The razorpay logo loads and white screen appears.
  3. REMEMBER THIS HAPPENS ONLY IN RELEASE BUILD.

Expected Results

It should go to razorpay checkout page where user can select the different types of payment

Snack, code example, screenshot, or link to a repository:

#371

@vivekshindhe
Copy link
Contributor

@bala-slaylewks Have you added proguard rules to your project? If not can you please add them. It can be found here

@bala-slaylewks
Copy link
Author

Thanks @vivekshindhe
It worked for me.
Btw, what is this proguard rules used for?

@AbhiAppBuddy
Copy link

facing same issue

razorpay_flutter: ^1.3.7
flutter- 3.24.1

I also tried to add proguard rules but it is not working for me

@bala-slaylewks
Copy link
Author

bala-slaylewks commented Sep 26, 2024 via email

@bala-slaylewks
Copy link
Author

bala-slaylewks commented Sep 26, 2024 via email

@megha-geobull
Copy link

Flutter 3.16.7
razropay: 1.3.7

"Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function"
after adding proguard still shows this error and doesnot redirect back after payment suceess

@Shiba-Kar
Copy link

Shiba-Kar commented Oct 14, 2024

app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "xxxxxxx.com"
    compileSdk 34
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "xxxxxxxx.com"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 21
        targetSdkVersion 34
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
  signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
     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.release
            minifyEnabled true // Enable minification
            shrinkResources true // Optimize resources
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {}

proguard-rules.pro

-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}


#Flutter Wrapper
-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.**  { *; }

have a live key rzp_live_****************

E/com.razorpay.checkout(32354): Webview JS Error: Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function
I/chromium(32354): [INFO:CONSOLE(1)] "Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function", source: https://api.razorpay.com/v1/checkout/public?version=1.6.40&library=checkoutjs&platform=android&session_token=B12EE64251D2280C281749AF1B54ABF1A8724F4DFAD13FA08B0A1646A0FAA788DEF588FC828E6E89DB923E4BC27E24B454EE67980F44004FCF83D476E09E0A1B6CBA95572FEE2540A9EA9352C133FC55B61C6DFC0D8BAC1F6D83BC4084A9EB65DCC8665F5E223B0C&traffic_env=canary (1)

using a rzp_test_*********** works perfectly !!!

@Shiba-Kar
Copy link

Check with the razorpay about the bank enabled or disabled ! .In our case the bank was disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants