aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.33k stars 247 forks source link

Build failed #2162

Closed kameshkarthi closed 1 year ago

kameshkarthi commented 2 years ago

Description

When i add amplify dependencies in pubspec build failed with following error

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.2.0-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)

i am using following versions amplify_auth_cognito: ^0.6.8 amplify_storage_s3: ^0.6.8 amplify_flutter: ^0.6.8

Anybody help to fix this?

Categories

Steps to Reproduce

No response

Screenshots

No response

Platforms

Android Device/Emulator API Level

No response

Environment

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.18363.1379], locale en-IN)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.1)
[√] VS Code (version 1.71.1)
[√] VS Code, 64-bit edition (version 1.47.3)
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

Dependencies

Dart SDK 2.18.1
Flutter SDK 3.3.2
app 1.0.0+1

dependencies:
- agora_rtc_engine 5.3.0 [flutter flutter_web_plugins js json_annotation]
- amplify_auth_cognito 1.0.0-next.0+5 [amplify_auth_cognito_android amplify_auth_cognito_dart amplify_auth_cognito_ios amplify_core amplify_flutter amplify_secure_storage async flutter flutter_web_plugins meta path plugin_platform_interface]
- amplify_flutter 1.0.0-next.0+3 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios amplify_secure_storage aws_common collection flutter meta plugin_platform_interface]
- amplify_storage_s3 1.0.0-next.0+2 [amplify_storage_s3_android amplify_storage_s3_ios amplify_core aws_common flutter meta plugin_platform_interface]
- another_audio_recorder 1.0.1 [path flutter file]
- another_xlider 1.1.2 [flutter]
- audioplayers 1.0.1 [audioplayers_android audioplayers_darwin audioplayers_linux audioplayers_platform_interface audioplayers_web audioplayers_windows flutter http path_provider uuid]
- auto_size_text 3.0.0 [flutter]
- cached_network_image 3.2.2 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- cached_video_player 2.0.3 [meta video_player_platform_interface video_player_web flutter flutter_test]
- camera 0.10.0+1 [camera_android camera_avfoundation camera_platform_interface camera_web flutter flutter_plugin_android_lifecycle quiver]
- collection 1.16.0
- connectivity_plus 2.3.7 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- cron 0.5.0 [clock]
- crop 0.5.2 [flutter collision vector_math]
- crypto 3.0.2 [typed_data]
- cupertino_icons 1.0.5
- dio 4.0.6 [http_parser path]
- dio_cache_interceptor 3.3.1 [dio uuid string_scanner]
- extended_text 9.1.2 [extended_text_library flutter]
- firebase_core 1.23.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_dynamic_links 4.3.8 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]      
- firebase_messaging 13.0.3 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_remote_config 2.0.18 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_countdown_timer 4.1.0 [flutter]
- flutter_ffmpeg 0.4.2 [flutter]
- flutter_image_compress 1.1.3 [flutter]
- flutter_linkify 5.0.2 [flutter linkify]
- flutter_local_notifications 11.0.0 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_native_image 0.0.6+1 [flutter]
- flutter_staggered_grid_view 0.6.2 [flutter]
- flutter_svg 1.1.5 [flutter meta path_drawing vector_math xml]
- geocoding 2.0.5 [flutter geocoding_platform_interface]
- geolocator 9.0.2 [flutter geolocator_platform_interface geolocator_android geolocator_apple geolocator_web geolocator_windows]
- get 4.6.5 [flutter]
- giphy_get 3.1.1 [flutter flutter_localizations provider extended_image flutter_staggered_grid_view meta http url_launcher]
- google_fonts 3.0.1 [flutter http path_provider crypto]
- hashtagable 2.1.0 [flutter]
- hive 2.2.3 [meta crypto]
- hsv_color_pickers 0.2.2 [flutter]
- html 0.15.0 [csslib source_span]
- http 0.13.5 [async http_parser meta path]
- image 3.2.0 [archive meta xml]
- image_cropper 3.0.0 [flutter image_cropper_platform_interface image_cropper_for_web]
- image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface]
- in_app_update 3.0.0 [flutter]
- intl 0.17.0 [clock path]
- inview_notifier_list 3.0.0 [flutter stream_transform]
- json_annotation 4.7.0 [meta]
- light_compressor 1.2.2 [flutter]
- liquid_pull_to_refresh 3.0.1 [flutter]
- local_auth 2.1.2 [flutter intl local_auth_android local_auth_ios local_auth_platform_interface local_auth_windows]
- location 4.4.0 [flutter location_platform_interface location_web]
- lottie 1.4.3 [archive flutter path vector_math]
- lzstring 2.0.0+2 [typed_data]
- matrix_gesture_detector 0.2.0-nullsafety.1 [flutter vector_math]
- mime 1.0.2
- ntp 2.0.0
- oktoast 3.3.0 [flutter]
- package_info_plus 1.4.3+1 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- painter 2.0.0 [flutter]
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- permission_handler 10.0.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]       
- photo_manager 2.3.0 [flutter]
- photo_view 0.14.0 [flutter]
- pin_code_fields 7.4.0 [flutter]
- provider 6.0.3 [collection flutter nested]
- receive_sharing_intent 1.4.5 [flutter]
- rich_text_controller 1.4.0 [flutter]
- rxdart 0.27.5
- screenshot 1.2.3 [flutter]
- scroll_to_index 3.0.1 [flutter]
- scrollable_positioned_list 0.3.4 [flutter collection]
- sensors_plus 1.3.4+1 [flutter sensors_plus_web sensors_plus_platform_interface]
- share 2.0.4 [meta mime flutter]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- simple_animations 5.0.0+2 [flutter collection]
- socket_io_client 2.0.0 [logging socket_io_common js]
- url_launcher 6.1.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 3.0.6 [crypto]
- vibration 1.7.6 [flutter]
- visibility_detector 0.3.3 [flutter]
- weather 2.0.1 [flutter http]

transitive dependencies:
- amplify_auth_cognito_android 1.0.0-next.0+2 [flutter]
- amplify_auth_cognito_dart 0.1.6 [amplify_core amplify_secure_storage_dart async aws_common aws_signature_v4 built_collection built_value collection convert crypto fixnum http intl js json_annotation meta oauth2 path smithy smithy_aws stream_transform uuid worker_bee]
- amplify_auth_cognito_ios 1.0.0-next.0+3 [amplify_core flutter]
- amplify_core 1.0.0-next.0+1 [async aws_common aws_signature_v4 collection intl json_annotation logging meta uuid]
- amplify_datastore_plugin_interface 1.0.0-next.0+1 [amplify_core collection flutter meta]
- amplify_flutter_android 1.0.0-next.0 [flutter]
- amplify_flutter_ios 1.0.0-next.0+1 [amplify_core flutter]
- amplify_secure_storage 0.1.1 [amplify_secure_storage_dart async file flutter meta path path_provider]
- amplify_secure_storage_dart 0.1.1 [async aws_common built_collection built_value ffi file js meta path win32 worker_bee]
- amplify_storage_s3_android 1.0.0-next.0 [flutter]
- amplify_storage_s3_ios 1.0.0-next.0 [flutter]
- archive 3.3.1 [crypto path]
- args 2.3.1
- async 2.9.0 [collection meta]
- audioplayers_android 1.0.1 [audioplayers_platform_interface flutter]
- audioplayers_darwin 1.0.1 [audioplayers_platform_interface flutter]
- audioplayers_linux 1.0.0 [audioplayers_platform_interface flutter]
- audioplayers_platform_interface 1.0.0 [flutter plugin_platform_interface]
- audioplayers_web 1.0.0 [audioplayers_platform_interface flutter flutter_web_plugins]
- audioplayers_windows 1.0.0 [audioplayers_platform_interface flutter]
- aws_common 0.2.3 [async collection http2 js json_annotation logging meta stream_transform uuid]
- aws_signature_v4 0.2.2 [async aws_common collection convert crypto json_annotation meta path]
- boolean_selector 2.1.0 [source_span string_scanner]
- built_collection 5.1.1
- built_value 8.4.1 [built_collection collection fixnum meta]
- cached_network_image_platform_interface 2.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.2 [flutter flutter_cache_manager cached_network_image_platform_interface]
- camera_android 0.10.0+2 [camera_platform_interface flutter flutter_plugin_android_lifecycle stream_transform]
- camera_avfoundation 0.9.8+5 [camera_platform_interface flutter stream_transform]
- camera_platform_interface 2.2.0 [cross_file flutter plugin_platform_interface stream_transform]
- camera_web 0.3.0 [camera_platform_interface flutter flutter_web_plugins stream_transform]
- characters 1.2.1
- clock 1.1.1
- collision 0.0.3 [vector_math]
- connectivity_plus_linux 1.3.1 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.4 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.1 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.3 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.2 [connectivity_plus_platform_interface flutter]
- convert 3.0.2 [typed_data]
- crclib 3.0.0 [meta tuple]
- cross_file 0.3.3+2 [js meta]
- csslib 0.17.2 [source_span]
- dbus 0.7.8 [args ffi meta xml]
- extended_image 6.3.1 [extended_image_library flutter meta]
- extended_image_library 3.4.0 [crypto flutter http_client_helper path path_provider]
- extended_text_library 9.1.1 [flutter]
- fake_async 1.3.1 [clock collection]
- ffi 2.0.1
- file 6.1.4 [meta path]
- firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 1.7.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_dynamic_links_platform_interface 0.2.3+13 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 4.1.5 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.1.5 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_remote_config_platform_interface 1.1.17 [firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.1.6 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]
- fixnum 1.0.1
- flutter_blurhash 0.7.0 [flutter]
- flutter_local_notifications_linux 1.0.0 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 6.0.0 [flutter plugin_platform_interface]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_plugin_android_lifecycle 2.0.7 [flutter]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- geocoding_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- geolocator_android 4.1.3 [flutter geolocator_platform_interface]
- geolocator_apple 2.2.2 [flutter geolocator_platform_interface]
- geolocator_platform_interface 4.0.6 [flutter plugin_platform_interface vector_math meta]
- geolocator_web 2.1.6 [flutter flutter_web_plugins geolocator_platform_interface]
- geolocator_windows 0.1.1 [flutter geolocator_platform_interface]
- http2 2.0.0
- http_client_helper 2.0.3 [http]
- http_parser 4.0.1 [collection source_span string_scanner typed_data]
- image_cropper_for_web 1.0.2 [flutter flutter_web_plugins image_cropper_platform_interface js]
- image_cropper_platform_interface 3.0.2 [flutter plugin_platform_interface http]
- image_picker_android 0.8.5+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_ios 0.8.6+1 [flutter image_picker_platform_interface]
- image_picker_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface]
- js 0.6.4
- linkify 4.1.0
- local_auth_android 1.0.12 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface]
- local_auth_ios 1.0.9 [flutter intl local_auth_platform_interface]
- local_auth_platform_interface 1.0.4 [flutter intl plugin_platform_interface]
- local_auth_windows 1.0.3 [flutter local_auth_platform_interface]
- location_platform_interface 2.3.0 [flutter meta plugin_platform_interface]
- location_web 3.1.1 [flutter flutter_web_plugins http_parser js location_platform_interface meta]
- logging 1.0.2
- matcher 0.12.12 [stack_trace]
- material_color_utilities 0.1.5
- meta 1.8.0
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- oauth2 2.0.0 [collection crypto http http_parser]
- octo_image 1.0.2 [flutter flutter_blurhash]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 2.1.0 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.2
- path_drawing 1.0.1 [vector_math meta path_parsing flutter]
- path_parsing 1.0.1 [vector_math meta]
- path_provider_android 2.0.20 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.11 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
- path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_android 10.0.0 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.0.4 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.7.1 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.0 [flutter permission_handler_platform_interface]
- petitparser 5.0.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.3 [meta]
- process 4.2.4 [file path platform]
- quiver 3.1.0 [matcher]
- retry 3.1.0
- sensors_plus_platform_interface 1.1.1 [flutter meta plugin_platform_interface]
- sensors_plus_web 1.1.1 [flutter sensors_plus_platform_interface flutter_web_plugins]
- shared_preferences_android 2.0.13 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- shelf 1.4.0 [async collection http_parser path stack_trace stream_channel]
- sky_engine 0.0.99
- smithy 0.1.1 [async aws_common built_collection built_value collection convert crypto fixnum http_parser intl json_annotation meta path retry shelf typed_data xml] 
- smithy_aws 0.1.2 [aws_common aws_signature_v4 built_collection built_value collection crclib intl json_annotation meta path smithy xml]
- socket_io_common 2.0.0 [logging]
- source_span 1.9.0 [collection path term_glyph]
- sqflite 2.1.0 [flutter sqflite_common path]
- sqflite_common 2.3.0 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.1 [source_span]
- synchronized 3.0.0+3
- term_glyph 1.2.1
- test_api 0.4.12 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.9.0 [path]
- tuple 2.0.0 [quiver]
- typed_data 1.3.1 [collection]
- url_launcher_android 6.0.19 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface]
- url_launcher_web 2.0.13 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
- vector_math 2.1.2
- video_player_platform_interface 5.1.4 [flutter plugin_platform_interface]
- video_player_web 2.0.12 [flutter flutter_web_plugins video_player_platform_interface]
- win32 2.7.0 [ffi]
- worker_bee 0.1.1 [async aws_common built_collection built_value collection js meta path stack_trace stream_channel stream_transform]
- xdg_directories 0.2.0+2 [meta path process]
- xml 6.1.0 [collection meta petitparser]

Device

Sony xperia z2

OS

Android 7.1.2

Deployment Method

Amplify CLI

CLI Version

4.46.1

Additional Context

No response

Amplify Config

{ "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", }

Jordan-Nelson commented 2 years ago

i am using following versions amplify_auth_cognito: ^0.6.8 amplify_storage_s3: ^0.6.8 amplify_flutter: ^0.6.8

Hello @kameshkarthi - From the output of your dependencies, it looks like you are using version 1.0.0 (developer preview).

The following are listed as dependencies:

- amplify_auth_cognito 1.0.0-next.0+5 [amplify_auth_cognito_android amplify_auth_cognito_dart amplify_auth_cognito_ios amplify_core amplify_flutter amplify_secure_storage async flutter flutter_web_plugins meta path plugin_platform_interface]
- amplify_flutter 1.0.0-next.0+3 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios amplify_secure_storage aws_common collection flutter meta plugin_platform_interface]
- amplify_storage_s3 1.0.0-next.0+2 [amplify_storage_s3_android amplify_storage_s3_ios amplify_core aws_common flutter meta plugin_platform_interface]

Can you confirm which version you are using so that we can try to reproduce this? Thanks.

juanrequeijo commented 2 years ago

Hello @Jordan-Nelson I am using:

amplify_auth_cognito: 0.5.1 amplify_flutter: 0.5.1

and there is this problem too.

I tested this version 0.6.8 and didn't work.

The work around is setting in build.gradle:

configurations { all*.exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx' }

fjnoyp commented 2 years ago

Hi @juanrequeijo @kameshkarthi

Thanks for reaching out here. The error appears to be that your dependencies use the kotlin and java version for the viewmodel library as described in this stackoverflow answer. I would recommend implementing the fix in that answer or using @juanrequeijo fix provided above.

https://stackoverflow.com/questions/69817925/problem-duplicate-class-androidx-lifecycle-viewmodel-found-in-modules

abdallahshaban557 commented 2 years ago

Hi @juanrequeijo @kameshkarthi - any luck with fixing this issue as mentioned by @fjnoyp ?

Jordan-Nelson commented 2 years ago

@juanrequeijo @kameshkarthi - Please let us know if you were not able to resolve the issue with the suggestion above. Thanks.

Stivenmore commented 1 year ago

I just ran into this problem, the solution is:

configurations { all { exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx' } }

Add that in your build.gradle.

Although, according to several android forums, this happens due to inconsistencies between the versions of lifecycle that are used, perhaps it would be good to review this in the library