razorpay / razorpay-flutter

Razorpay Flutter Plugin
MIT License
106 stars 147 forks source link

Flutter build fail because of razorpay package name conflict after upgrading to flutter version 3.24.0 #397

Open neerajapex opened 1 month ago

neerajapex commented 1 month ago

After day one of upgrading Flutter to Flutter version 3.24.0, I suddenly started getting build issues because of the conflict with the Razorpay package name 'com.razorpay'.

Description

Below is the error log:

[com.razorpay:checkout:1.6.40] /Users/..../.gradle/caches/transforms-3/8865b1e92255561aafb98c9aa637d5cd/transformed/jetified-checkout-1.6.40/AndroidManifest.xml Error:
    Package name 'com.razorpay' used in: com.razorpay:checkout:1.6.40, com.razorpay:standard-core:1.6.40.
/Users/neerdev/Desktop/flutter_workspace/..../..../android/app/src/debug/AndroidManifest.xml Error:
    Validation failed, exiting
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDevelopmentDebugMainManifest'.

Flutter Version :

Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 80c2e84975 (9 days ago) • 2024-07-30 23:06:49 +0700 Engine • revision b8800d88be Tools • Dart 3.5.0 • DevTools 2.37.2

I tried the below approaches with no luck. The build is still failing.

  1. Tried by upgrading the razorpay library to razorpay_flutter 1.3.7.
  2. Tried repairing or even deleting the cache.
  3. Tried the commands 'fvm flutter pub upgrade' 'fvm flutter clean' 'fvm flutter pug get'

Steps To Reproduce

  1. I upgraded the flutter version from 3.22.3 to 3.24.0.
  2. I upgraded the jitsi_meet_flutter_sdk from version 0.1.4 to 0.4.2.

Expected Results

Build should work without error.

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

pubspec.yaml

publish_to: none

    environment:
      sdk: ">=2.19.0 <4.0.0"
      flutter: 3.24.0

    dependencies:
      bloc: ^8.1.1
      flutter:
        sdk: flutter
      flutter_web_plugins:
        sdk: flutter
      flutter_bloc: ^8.1.2
      flutter_localizations:
        sdk: flutter
      firebase_auth: ^4.19.5
      firebase_core: ^2.24.2
      firebase_auth_platform_interface: ^7.2.6
      firebase_crashlytics: ^3.3.7
      firebase_messaging: ^14.6.9
      firebase_core_platform_interface: ^5.0.0
      firebase_analytics: ^10.5.1
      firebase_remote_config: ^4.2.7
      firebase_dynamic_links: ^5.3.7
      intl: ^0.18.1
      basic_utils: ^5.2.2
      cached_network_image: ^3.3.0
      connectivity_plus: ^6.0.3
      date_format: ^2.0.6
      dio: ^4.0.6
      fhir: ^0.9.0
      fhir_at_rest: ^0.9.0
      file_picker: ^8.0.3
      equatable: ^2.0.5
      flutter_html: ^3.0.0-alpha.5
      flutter_image_compress: ^2.0.4
      flutter_keyboard_visibility: ^6.0.0
      flutter_local_notifications: ^17.1.2
      get_it: ^7.2.0
      getwidget: ^4.0.0
      google_fonts: ^5.1.0
      google_maps_flutter: ^2.2.0
      google_maps_webservice: ^0.0.20-nullsafety.5
      google_sign_in: ^5.4.1
      http: ^1.0.0
      http_interceptor: ^1.0.2
      jitsi_meet_flutter_sdk: ^0.4.2
      json_annotation: ^4.6.0
      json_serializable: ^6.3.1
      local_auth: ^2.1.2
      location: ^6.0.2
      maps_launcher: ^2.0.1
      mime: ^1.0.2
      oauth2_client: ^3.0.0
      palette_generator: ^0.3.3+2
      path: ^1.6.4
      path_provider: ^2.0.11
      path_provider_android: ^2.2.0
      permission_handler: ^11.0.0
      provider: ^6.0.3
      razorpay_flutter: ^1.3.7
      shared_preferences: ^2.0.15
      url_launcher: ^6.1.5
      uuid: ^3.0.6
      validators: ^3.0.0
      age_calculator: ^1.0.0
      auth_buttons: ^3.0.2
      package_info_plus: ^4.2.0
      webview_flutter: ^4.7.0
      flutter_widget_from_html_core: ^0.14.6
      collection: ^1.15.0-nullsafety.4
      wello_auth:
        path: ../wello_auth
      device_info_plus: ^10.1.0
      random_string: ^2.3.1
      image_picker: ^1.0.4
      upgrader: ^10.3.0
      theme_provider: ^0.6.0
      responsive_grid: ^2.1.0
      infinite_listview: ^1.1.0
      animated_icon_button: ^1.0.2
      badges: ^3.1.2
      gradient_slider: ^1.0.2
      fl_chart: ^0.68.0
      community_charts_flutter: ^1.0.4
      chewie: ^1.3.5
      date_picker_timeline: ^1.2.5
      date_picker_timeline_fixed: ^2.0.0
      expandable: ^5.0.1
      fancy_shimmer_image: ^2.0.2
      floating_action_bubble: ^1.1.4
      flutter_cupertino_date_picker_fork: ^1.0.6
      table_calendar: ^3.0.8
      flutter_calendar_carousel: ^2.4.3
      calendar_date_picker2: ^1.1.5
      flutter_full_pdf_viewer_null_safe: ^1.0.0
      pdf: ^3.8.3
      advance_pdf_viewer:
        git:
          url: git@github.com:lohanidamodar/pdf_viewer.git
          ref: 4e5d96be29de515f1081c0b6897741b8dca84722
      flutter_shimmer: ^2.1.2
      flutter_spinkit: ^5.1.0
      rflutter_alert: ^2.0.7
      shimmer: ^3.0.0
      sprintf: ^7.0.0
      flutter_svg: ^2.0.7
      flutter_swiper_view: ^1.1.8
      font_awesome_flutter: ^10.2.1
      percent_indicator: ^4.2.3
      pin_code_fields: ^8.0.1
      pin_input_text_field: ^4.2.0
      auto_size_text: ^3.0.0
      expandable_text: ^2.3.0
      sticky_headers: ^0.3.0+2
      super_tooltip: ^2.0.7
      timeline_tile: ^2.0.0
      version_banner: ^1.0.0-nullsafety.0
      video_player: null
      youtube_player_flutter: ^9.0.1
      another_flushbar: ^1.12.29
      fluttertoast: ^8.0.9
      another_xlider: ^3.0.1
      search_choices: ^2.1.1
      roundcheckbox: ^2.0.5
      flutter_native_splash: ^2.2.10
      flutter_sound_lite: ^8.5.0
      flutter_chat_bubble: ^2.0.2
      flutter_chat_ui: ^1.6.6
      dash_chat_2: ^0.0.15
      pkce: ^1.1.0+1
      app_settings: ^5.1.1

    dev_dependencies:
      bloc_test: ^9.1.1
      flutter_test:
        sdk: flutter
      mocktail: ^1.0.1
      build_runner: ^2.2.0
      very_good_analysis: ^5.1.0
      flutter_launcher_icons: ^0.13.1

    dependency_overrides:
      http: ^0.13.4
      intl: ^0.17.0

    flutter_native_splash:
      color: "#ffffff"
      background_image: "assets/images/ic_launcher_round.png"

    flutter_icons:
      android: "launcher_icon"
      ios: true
      image_path: "assets/images/ic_launcher_round.png"
      min_sdk_android: 21

    flutter:
      uses-material-design: true
      generate: true
      assets:
        - assets/lang/
        - assets/images/
        - assets/images/emojis/
        - assets/conf/
        - assets/pdfs/
vivekshindhe commented 1 month ago

@neerajapex Thanks for bringing this to our attention. Looking into this.

vivekshindhe commented 1 month ago

@neerajapex So I wasn't able to reproduce the issue with just the version 3.24.0. Would it be possible for you to specify the gradle versions your project is using?

neerajapex commented 1 month ago

@vivekshindhe

  1. gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

  2. build.gradle:

    
    ext.kotlin_version = '1.8.10'

dependencies { classpath 'com.android.tools.build:gradle:7.1.2' // START: FlutterFire Configuration classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' // END: FlutterFire Configuration classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }

neerajapex commented 1 month ago

android { compileSdkVersion 34

compileOptions {
    coreLibraryDesugaringEnabled true
    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 "com.appname"
    minSdkVersion 24
    targetSdkVersion 34
    multiDexEnabled true
    versionCode 87
    versionName '1.0.0'
}

signingConfigs {
    if (System.getenv("ANDROID_KEYSTORE_PATH")) {
        release {
            storeFile file(System.getenv("ANDROID_KEYSTORE_PATH"))
            keyAlias System.getenv("ANDROID_KEYSTORE_ALIAS")
            keyPassword System.getenv("ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
            storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
        }
    } else {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
}

flavorDimensions "default"
productFlavors { 
    qa {
        dimension "default"
        applicationIdSuffix ".qa"
        manifestPlaceholders = [appName: "App-QA"]
    }
    development {
        dimension "default"
        applicationIdSuffix ".dev"
        manifestPlaceholders = [appName: "App-Dev"]
    }
}

buildTypes {
    release {
        /* ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
        } */
        signingConfig signingConfigs.release
        minifyEnabled true
        shrinkResources true
        proguardFiles (
            getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        )
    }
}
packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
    pickFirst 'lib/x86/libfbjni.so'
    pickFirst 'lib/x86_64/libc++_shared.so'
    pickFirst 'lib/x86_64/libfbjni.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libfbjni.so'
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
    pickFirst 'lib/arm64-v8a/libfbjni.so'
}

}

flutter { source '../..' }

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "androidx.browser:browser:1.3.0" coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation 'androidx.window:window:1.0.0' implementation 'androidx.window:window-java:1.0.0' }

vivekshindhe commented 1 month ago

@neerajapex thank you. While I look into this, just as a check can you please use the older flutter version you were using and see if this issue is happening there as well?

neerajapex commented 1 month ago

@vivekshindhe Thanks for your reply. I have tried that also. But now the older version also throws the same build error. I tried rebuilding and deleting the cache also but no luck.

neerajapex commented 1 month ago

@vivekshindhe I am kind of stuck because of this error. Any direction to resolve this will be very helpful.

vivekshindhe commented 1 month ago

@neerajapex Hey, we are looking into this. I'm not able to reproduce the issue. Not sure what the difference is between your project and mine. Until we get to the bottom of this, can you try reinstalling the razorpay_flutter package in your project?

neerajapex commented 1 month ago

@vivekshindhe Thanks. I'll try.

neerajapex commented 1 month ago

@vivekshindhe I tried reinstalling the razorpay_flutter package, but I am still getting the same build error.

vivekshindhe commented 1 month ago

@neerajapex will be releasing an update today to resolve this.

neerajapex commented 1 month ago

@vivekshindhe Thanks. Waiting for the release. I'll let you know after testing the fix.

vivekshindhe commented 1 month ago

@neerajapex The fix is live. Can you please test it once? As a precaution, please ensure to run Sync project with Gradle Files before testing.

neerajapex commented 1 month ago

@vivekshindhe Thanks. Finally, the build issue is gone. But to make this work I had to make some more changes. I am explaining those changes in case anyone faces the same issue.

1. gradle-wrapper.properties: Upgrade gradle version: distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip upgraded to distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

Note: I can't use the 8.x version because I have Java 11 in my system and it needs Java 17.

2. build.gradle: Upgrade Kotlin version: ext.kotlin_version = '1.8.10' upgraded to ext.kotlin_version = '1.9.0'

3. build.gradle: Upgrade gradle tool version classpath 'com.android.tools.build:gradle:7.1.2' upgraded to classpath 'com.android.tools.build:gradle:7.2.2'

4. Run the following command from the terminal to sync and refresh your gradle dependencies If working in VS Code.

$ cd android
$ ./gradlew --refresh-dependencies

5. Run the Flutter project.