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.32k stars 247 forks source link

Flutter build fails due to Amplify_core #1396

Closed moezelahi closed 2 years ago

moezelahi commented 2 years ago

Description

Hi,

I recently upgraded my flutter application to Android V2, and also made my code null safe.

Now when I try to run my code I get the below build error:

*e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (26, 1): 
Class 'AtomicResult' is not abstract and does not implement abstract member public abstract 
fun error(p0: String, p1: String?, p2: Any?): Unit defined in 
io.flutter.plugin.common.MethodChannel.Result
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (54, 5): 
'error' overrides nothing
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (66, 26): 
Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amplify_core:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get 
more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1*

You can also find the content of my build.gradle below:

buildscript {
    ext.kotlin_version = '1.5.31'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Things I tried that did not work:

Any help would be greatly appreciated!

Thanks

Categories

Steps to Reproduce

No response

Screenshots

No response

Platforms

Environment

[√] Flutter (Channel master, 2.11.0-0.0.pre.652, on Microsoft Windows [Version 10.0.19044.1526], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.5.4)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development
      with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2020.3)
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.64.1)
[√] Connected device (3 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

Dependencies

Dart SDK 2.17.0-138.0.dev
Flutter SDK 2.11.0-0.0.pre.652
flutter_urban_state 1.0.0+1

dependencies:
- amplify_api 0.4.0 [amplify_api_plugin_interface amplify_core collection flutter meta plugin_platform_interface]
- amplify_datastore 0.4.0 [flutter amplify_datastore_plugin_interface amplify_core plugin_platform_interface meta collection
async]
- amplify_flutter 0.4.0 [amplify_analytics_plugin_interface amplify_api_plugin_interface amplify_auth_plugin_interface amplif
y_core amplify_datastore_plugin_interface amplify_storage_plugin_interface collection flutter json_annotation meta plugin_pla
tform_interface]
- badges 2.0.2 [flutter]
- carousel_pro 1.0.0 [flutter]
- carousel_slider 4.0.0 [flutter]
- cloud_firestore 3.1.8 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platfo
rm_interface flutter meta]
- country_code_picker 2.0.2 [flutter modal_bottom_sheet collection universal_platform]
- country_picker 2.0.11 [flutter]
- cupertino_icons 1.0.4
- curved_navigation_bar 1.0.3 [flutter meta]
- dotted_border 2.0.0+2 [flutter path_drawing]
- f_datetimerangepicker 0.2.0 [flutter]
- firebase_auth 3.3.7 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flut
ter meta]
- firebase_auth_web 3.3.7 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_
parser intl js meta]
- firebase_core 1.12.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 11.2.6 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_me
ssaging_web flutter meta]
- firebase_storage 10.2.7 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storag
e_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine]
- flutter_datetime_picker 1.5.1 [flutter]
- flutter_local_notifications 9.3.2 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_int
erface timezone]
- flutter_secure_storage 5.0.2 [meta flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage
_platform_interface flutter_secure_storage_web flutter_secure_storage_windows]
- flutter_spinkit 5.1.0 [flutter]
- geocoding 2.0.2 [flutter geocoding_platform_interface]
- geolocator 8.2.0 [flutter geolocator_platform_interface geolocator_android geolocator_apple geolocator_web geolocator_windo
ws]
- google_fonts 2.3.1 [flutter http path_provider crypto]
- google_maps_webservice 0.0.19 [http meta]
- google_mobile_ads 1.1.0 [meta flutter]
- image_cropper 1.5.0 [flutter]
- image_picker 0.8.4+9 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- intl 0.17.0 [clock path]
- logger 1.1.0
- material_design_icons_flutter 5.0.6595 [flutter]
- mongo_dart 0.7.4 [bson crypto logging mongo_dart_query collection path pool basic_utils rational uuid sasl_scram vy_string_
utils]
- multi_image_picker2 5.0.02 [flutter]
- otp_text_field 1.1.2 [flutter]
- overlay_support 1.2.1 [flutter async]
- paginate_firestore 1.0.3 [flutter bloc flutter_bloc cloud_firestore provider]
- photo_view 0.13.0 [flutter]
- progress_indicators 1.0.0 [flutter]
- stream_chat_flutter 3.4.0 [cached_network_image characters chewie collection diacritic dio ezanimation file_picker flutter
flutter_markdown flutter_portal flutter_slidable flutter_svg http_parser image_gallery_saver image_picker jiffy lottie meta p
ath_provider photo_manager photo_view rxdart share_plus shimmer stream_chat_flutter_core substring_highlight synchronized url
_launcher video_compress video_player video_thumbnail visibility_detector]
- stream_chat_flutter_core 3.4.0 [collection connectivity_plus flutter meta rxdart stream_chat]
- syncfusion_flutter_datepicker 19.4.53 [flutter intl syncfusion_flutter_core]
- time_range 1.0.2 [flutter]
- timeago 3.2.2
- typicons_flutter 0.5.0 [flutter]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charco
de collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- amplify_analytics_plugin_interface 0.4.0 [amplify_core flutter meta]
- amplify_api_plugin_interface 0.4.0 [amplify_core collection flutter json_annotation meta]
- amplify_auth_plugin_interface 0.4.0 [flutter meta amplify_core]
- amplify_core 0.4.0 [flutter plugin_platform_interface collection date_time_format meta uuid]
- amplify_datastore_plugin_interface 0.4.0 [flutter meta collection amplify_core]
- amplify_storage_plugin_interface 0.4.0 [flutter meta amplify_core]
- archive 3.2.1 [crypto path]
- args 2.3.0
- asn1lib 1.1.0
- async 2.8.2 [collection meta]
- basic_utils 3.9.4 [http logging json_annotation pointycastle]
- bloc 7.2.1 [meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- bson 1.0.4 [fixnum rational uuid]
- buffer 1.1.1
- cached_network_image 3.2.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network
_image_web]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.2.0
- charcode 1.3.1
- chewie 1.3.0 [cupertino_icons flutter provider video_player wakelock very_good_analysis]
- clock 1.1.0
- cloud_firestore_platform_interface 5.4.13 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.6.8 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_we
b_plugins js]
- collection 1.15.0
- connectivity_plus 2.2.1 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos conne
ctivity_plus_web connectivity_plus_windows]
- connectivity_plus_linux 1.3.0 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.1 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.0 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.0 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.0 [connectivity_plus_platform_interface flutter]
- convert 3.0.1 [typed_data]
- cross_file 0.3.2 [flutter js meta]
- crypto 3.0.1 [collection typed_data]
- crypto_keys 0.3.0 [pointycastle meta collection quiver]
- csslib 0.17.1 [source_span]
- date_time_format 2.0.1
- dbus 0.7.1 [args ffi meta xml]
- diacritic 0.1.3
- dio 4.0.4 [http_parser path]
- equatable 2.0.3 [collection meta]
- ezanimation 0.6.0 [flutter]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- file_picker 4.4.0 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path]
- firebase_auth_platform_interface 6.1.11 [firebase_core flutter meta plugin_platform_interface]
- firebase_core_platform_interface 4.2.4 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.5.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 3.1.6 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.2.7 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plu
gins js meta]
- firebase_storage_platform_interface 4.0.14 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.2.8 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_p
lugins http js meta]
- fixnum 1.0.0
- flutter_bloc 7.3.3 [flutter bloc provider]
- flutter_blurhash 0.6.4 [flutter]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_local_notifications_linux 0.4.2 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_markdown 0.6.9 [flutter markdown meta path]
- flutter_plugin_android_lifecycle 2.0.5 [flutter]
- flutter_portal 0.4.0 [flutter]
- flutter_secure_storage_linux 1.1.0 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_macos 1.1.0 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_platform_interface 1.0.0 [flutter plugin_platform_interface]
- flutter_secure_storage_web 1.0.2 [flutter flutter_web_plugins flutter_secure_storage_platform_interface js]
- flutter_secure_storage_windows 1.1.2 [flutter flutter_secure_storage_platform_interface]
- flutter_slidable 0.6.0 [flutter]
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math]
- freezed_annotation 1.1.0 [collection json_annotation meta]
- geocoding_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- geolocator_android 3.1.0 [flutter geolocator_platform_interface]
- geolocator_apple 2.1.1+1 [flutter geolocator_platform_interface]
- geolocator_platform_interface 4.0.3 [flutter plugin_platform_interface vector_math meta]
- geolocator_web 2.1.4 [flutter flutter_web_plugins geolocator_platform_interface]
- geolocator_windows 0.1.0 [flutter geolocator_platform_interface]
- html 0.15.0 [csslib source_span]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image_gallery_saver 1.7.1 [flutter]
- image_picker_for_web 2.1.6 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_platform_interface 2.4.4 [cross_file flutter http plugin_platform_interface]
- jiffy 5.0.0 [intl]
- jose 0.3.2 [crypto_keys meta typed_data x509 http http_parser asn1lib collection]
- js 0.6.4
- json_annotation 4.4.0 [meta]
- logging 1.0.2
- lottie 1.2.2 [archive flutter path vector_math]
- markdown 4.0.1 [args charcode meta]
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- mime 1.0.1
- modal_bottom_sheet 2.0.0 [flutter]
- mongo_dart_query 1.0.2 [bson meta]
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- octo_image 1.0.1 [flutter flutter_blurhash]
- path 1.8.1
- path_drawing 1.0.0 [vector_math meta path_parsing flutter]
- path_parsing 1.0.0 [vector_math meta]
- path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_
platform_interface path_provider_windows]
- path_provider_android 2.0.11 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.7 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.5 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- petitparser 4.4.0 [meta]
- photo_manager 1.3.10 [flutter]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- pointycastle 3.5.1 [collection convert js]
- pool 1.5.0 [async stack_trace]
- process 4.2.4 [file path platform]
- provider 6.0.2 [collection flutter nested]
- quiver 3.0.1+1 [matcher]
- rate_limiter 0.1.1
- rational 1.2.1
- rxdart 0.27.3
- sasl_scram 0.1.0 [buffer crypto collection saslprep]
- saslprep 1.0.2 [pedantic unorm_dart]
- share_plus 3.1.0 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows shar
e_plus_web]
- share_plus_linux 2.0.4 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 2.0.2 [share_plus_platform_interface flutter]
- share_plus_platform_interface 2.0.1 [flutter meta mime plugin_platform_interface]
- share_plus_web 2.0.4 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 2.0.3 [share_plus_platform_interface flutter meta url_launcher]
- shimmer 2.0.0 [flutter]
- sky_engine 0.0.99
- source_span 1.8.2 [collection path term_glyph]
- sqflite 2.0.2 [flutter sqflite_common path]
- sqflite_common 2.2.0 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_chat 3.4.0 [async collection dio equatable freezed_annotation http_parser jose json_annotation logging meta mime rat
e_limiter rxdart uuid web_socket_channel]
- string_scanner 1.1.0 [charcode source_span]
- substring_highlight 1.0.33 [flutter]
- syncfusion_flutter_core 19.4.53 [vector_math flutter]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph mat
cher]
- timezone 0.8.0 [path]
- typed_data 1.3.0 [collection]
- universal_platform 1.0.0+1
- unorm_dart 0.2.0
- url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platf
orm_interface url_launcher_web url_launcher_windows]
- url_launcher_android 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.8 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- very_good_analysis 2.4.0
- video_compress 3.1.0 [flutter]
- video_player 2.2.18 [flutter video_player_android video_player_avfoundation video_player_platform_interface video_player_we
b html]
- video_player_android 2.3.0 [flutter video_player_platform_interface]
- video_player_avfoundation 2.3.0 [flutter video_player_platform_interface]
- video_player_platform_interface 5.1.0 [flutter plugin_platform_interface]
- video_player_web 2.0.7 [flutter flutter_web_plugins video_player_platform_interface]
- video_thumbnail 0.4.3 [flutter]
- visibility_detector 0.2.2 [flutter]
- vy_string_utils 0.4.3
- wakelock 0.6.1+1 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows]
- wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.3.0 [flutter meta]
- wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32]
- web_socket_channel 2.1.0 [async crypto stream_channel]
- win32 2.4.1 [ffi]
- x509 0.2.2 [asn1lib quiver crypto_keys]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]

Device

Pixel 4

OS

Android 12

Additional Context

No response

dnys1 commented 2 years ago

Thanks, @moezelahi - I've created a PR with the fix which should be released in the next Amplify version. This issue appears to only be reproducible on Flutter master due to a recent update to their method channel interface in Java. You should not experience the issue on the stable or beta branches.

moezelahi commented 2 years ago

OMG thank you very much! changing to stable fixed it!