Native Checkout Paypal Button not getting rendered for release apk in android

312

I solved the problem by adding shrinkResources false and minifyEnabled false in the android/app/build.gradle file under buildTypes. Hope this help you all.

buildTypes {
    release {
    // Signing with the debug keys for now, so `flutter run --release` works.
    shrinkResources false
    minifyEnabled false
    signingConfig signingConfigs.debug
  }
}
Share:
312
Humayun Rahi
Author by

Humayun Rahi

Updated on December 29, 2022

Comments

  • Humayun Rahi
    Humayun Rahi over 1 year

    I have implemented Native Checkout SDK for flutter using kotlin. The app works fine for the debug app. It shows screen like this.

    for debug app

    But when I build the release apk with the "flutter build apk --release" commaned it doesn't render. It shows the loading bar then disappear. And I used internet permission as well. So what is the reasone and how can I resolve it?

    enter image description here enter image description here

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
    }
    
    def flutterRoot = localProperties.getProperty('flutter.sdk')
     if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with 
    flutter.sdk in the local.properties file.")
    }
    
    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
    flutterVersionCode = '1'
    }
    
    def flutterVersionName = localProperties.getProperty('flutter.versionName')
      if (flutterVersionName == null) {
      flutterVersionName = '1.0'
     }
    
     apply plugin: 'com.android.application'
     apply plugin: 'kotlin-android'
     apply plugin: 'kotlin-android-extensions'
     apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
     android {
      compileSdkVersion 30
    
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    
     lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
      }
    
     defaultConfig {
        // TODO: Specify your own unique Application ID 
    (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.flutterkotlinpypl"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    
    buildTypes {
        release {
            debuggable true
            // 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
        }
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    
    kotlinOptions {
        jvmTarget = "1.8"
    }
    }
    
    flutter {
    source '../..'
    }
    
    dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation('com.paypal.checkout:android-sdk:0.1.0')
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.amplitude:android-sdk:2.31.0'
    implementation 'com.squareup.okhttp3:okhttp:4.2.2'
    }