Adyen / adyen-flutter

MIT License
22 stars 3 forks source link

Build failed - FlutterError is defined multiple times #196

Closed matmicro closed 2 weeks ago

matmicro commented 3 weeks ago

As soon as adyen_checkout is added to my pubspec.yaml the project won't build and start.

To Reproduce Steps to reproduce the behavior:

Build output `D8: Type FlutterError is defined multiple times: app\build\wakelock_plus.transforms\8ec7544f9f59b8a3be004ac195f9a85e\transformed\classes\classes.dex, app\build\adyen_checkout.transforms\0f1c84428db871ac029e9ad04055e1e2\transformed\classes\classes.dex

BUILD FAILED [!] App requires Multidex support Multidex support is required for your android app to build since the number of methods has exceeded 64k. See https://docs.flutter.dev/deployment/android#enabling-multidex-support for more information. You may pass the --no-multidex flag to skip Flutter's multidex support to use a manual solution.

Your `android/app/src/main/AndroidManifest.xml` does not contain `android:name="${applicationName}"` under the `application` element. This may be due to creating your project with an old version of Flutter. Add the `android:name="${applicationName}"` attribute to your AndroidManifest.xml to enable Flutter's multidex support:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      ...
      <application
        ...
        android:name="${applicationName}"
        ...>

`

Smartphone (please complete the following information):

Robert-SD commented 3 weeks ago

Hello @matmicro,

Thanks for opening the issue. We would like to help you in resolving the problem.

Would it be possible to provide more information? As the failure mentions Multidex, could you provide the Android minSDKVersion you use? With API 21 and higher, Multidex is enabled by default. Otherwise, enabling it might solve the problem.

We also created a new Flutter project and added both dependencies. Unfortunately, the error does not appear and the example app builds. Would it be possible to do the same and try out the dependencies in a new Flutter project?

matmicro commented 3 weeks ago

I am using :

matmicro commented 3 weeks ago

Can you try using dependency adyen_dropin at the same time ? I am currently using adyen_dropin which use minSdkVersion 16

Robert-SD commented 3 weeks ago

Hello @matmicro, thank you for providing the minSDKversion. We were able to reproduce the issue and would like to suggest a solution. Could you update to wakelock_plus: ^1.2.0 or newer? This version contains a custom error name resolving duplicated class names with other libraries.

In addition, we also introduced a custom error name within the adyen_checkout library. This is the PR. Feel free to test out the main branch, as the PR is already merged.

matmicro commented 3 weeks ago

Thanks for feedback.

Unfortunately wakelock_plus: ^1.2.0 is Dart 3.3 which is a blocker for me now.

Does the PR will be released soon on Flutter pub.dev package ? I am currently using adyen_checkout: ^0.1.0

matmicro commented 3 weeks ago

I am moving to Dart 3.0 and it looks fine now. Thanks & regards

Robert-SD commented 2 weeks ago

Hi @matmicro,

great to hear. Thanks for pointing it out. The change will be part of the next release.