PayHereLK / payhere-mobilesdk-flutter

PayHere Mobile SDK for Flutter
BSD 3-Clause "New" or "Revised" License
5 stars 14 forks source link

Works fine in the debugging version. But in the released APK, this error occurs. #7

Closed nipunai7 closed 2 years ago

nipunai7 commented 2 years ago

Screenshot_1627728834

PayHereDevs commented 2 years ago

Hello Nipuna!

This looks like an issue with Android Code Minification.

Please add the following line to your project's "/android/app/proguard-rules.pro" file.

-keep class lk.payhere.** { *; }

If the "proguard-rules.pro" file does not exist, you can simply create one in the project's "/android/app" folder.

After adding a new file, make sure it is included in the project's "/android/app/build.gradle" file as shown below (refer to the two lines after the asterisk marks)

android {
 compileSdkVersion 29

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

  lintOptions {
    disable 'InvalidPackage'
  }

  defaultConfig {
    // Android configurations are usually here
  }

  // Signing Configurations are usually here

  buildTypes {
    release {

      signingConfig signingConfigs.debug

      minifyEnabled enableProguardInReleaseBuilds
      // ******** Add the following two lines *********
      useProguard true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }
  }
}