'Flutter Plugin 'permission_handler' causing errors during build

I'm trying to build my Flutter app and I keep running into an issue where the build fails and throws the following errors:

Task :permission_handler:compileDebugJavaWithJavac FAILED
/Users/ralph/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-6.1.3/android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java:152: warning: [deprecation] getDefaultAdapter() in BluetoothAdapter has been deprecated
        final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
                                                                  ^
error: warnings found and -Werror specified
1 error
1 warning

warnings found and -Werror specified

Below is my output from flutter doctor -v:

[✓] Flutter (Channel stable, 2.10.0, on macOS 12.0.1 21A559 darwin-arm, locale en-US)
    • Flutter version 2.10.0 at /Users/ralph/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5f105a6ca7 (11 days ago), 2022-02-01 14:15:42 -0800
    • Engine revision 776efd2034
    • Dart version 2.16.0
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/ralph/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

The thing is I am not even using permission_handler in my project dependencies. Below are my project dependencies:

cupertino_icons: ^1.0.2
  get: 4.1.4
  image_picker: any
  image_cropper: any
  flutter_image_compress: any
  universal_html: any
  intl_phone_number_input: 0.7.0+2
  step_progress_indicator: 1.0.1
  intl: 0.17.0
  shared_preferences: any
  otp_text_field: 1.1.1
  connectivity: 3.0.6
  readmore: 2.1.0
  google_fonts: 2.1.0
  otp_count_down: 1.0.6
  firebase_messaging: any
  flutter_local_notifications: any
  firebase_core: any
  flutter_svg: 0.22.0
  table_calendar: 3.0.1
  flutter_time_picker_spinner: 2.0.0
  google_maps_flutter: any
  custom_info_window: any
  bubble: 1.2.1
  double_back_to_close_app: 2.0.1
  group_radio_button: 1.1.0
  graphql_flutter: 5.0.0
  hive: any
  hive_flutter: any
  path_provider: any
  google_maps_place_picker: any
  flutter_speed_dial: 4.2.0
  emoji_picker: any
  emoji_picker_flutter: 1.0.6
  flutter_slidable: 0.6.0
  firebase_auth: any
  amplify_auth_cognito: any
  amplify_flutter: any
  amplify_datastore: any
  amplify_api: any
  amplify_storage_s3: 0.2.2
  crypto: 3.0.1
  latlong: 0.6.1
  geolocator: 7.7.1
  flutter_native_splash: 1.2.2
  skeleton_loader: 2.0.0+4
  cached_network_image: 3.1.0
  emojis: 0.9.3
  autocomplete_textfield: 1.7.3
  mqtt_client: 9.6.0
  pull_to_refresh: 2.0.0
  flutter_cache_manager: 3.1.2
  wc_flutter_share: 0.4.0
  custom_refresh_indicator: 1.0.0
  flutter_contacts: 1.1.1+2
  grouped_list: 4.1.0
  full_screen_image: 1.0.2
  loadmore: 2.0.1
  flutter_dotenv: 5.0.2
  stamp_image: 0.0.2
  proste_bezier_curve: 2.0.2
  screenshot: 1.2.3
  flutter_autolink_text: 1.0.0+1
  url_launcher: any
  flutter_offline: 2.0.0
  internet_connection_checker: 0.0.1+3
  flutter_rating_bar: 4.0.0
  get_storage: 2.0.3
  twilio_flutter: 0.0.9
  upgrader: any
  google_ml_vision: 0.0.7

How do I resolve this issue ??



Solution 1:[1]

Actually google_maps_place_picker uses permission_handler see attached image

try override package to lates version user

dependency_overrides:
 permission_handler: latest version 

current latest version for permission_handler ^ 8.3.0

then do flutter clean && flutter pub get

Solution 2 : use other updated package as google_maps_place_picker last update 14 month ago

enter image description here

Solution 2:[2]

try one of the following

  1. , run

    flutter clean

then restart the emulator

  1. , run

    flutter pub get

then restart the emulator

hope its work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hurab
Solution 2 Ali Nabel