Flutter:任务“:geolocator:compileDebugJavaWithJavac”执行失败;

发布于 2025-01-12 02:18:21 字数 12768 浏览 6 评论 0原文

该项目于今年一月前完美建成。但现在它告诉我错误。首先他们向我显示位置 16+ 错误。然后我将位置包更改为地理定位器。但不固定。 然后创建新项目并导入旧代码库。 并将目标和compilesdk更改为31。并取消注释compileOptions

这是我的应用程序级别build.gradle-

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 31

    // compileOptions {
    //     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 "care.appnameexample.health"
        minSdkVersion 23
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation 'com.google.firebase:firebase-messaging:20.1.6'
}
apply plugin: 'com.google.gms.google-services'

这是我的pubspec.yaml file -

name: appnameexample
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"  // Environment changed after transfer to new project

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  curved_navigation_bar: ^0.3.3
  animations: ^1.1.2
  auto_size_text: ^2.1.0
  flutter_signin_button: ^1.1.0
  http: ^0.12.2
  progress_dialog: ^1.2.4
  intl: ^0.17.0
  chips_choice: ^1.4.1
  rflutter_alert: ^1.1.0
  provider: ^4.3.2+2
  fluid_bottom_nav_bar: ^1.1.1
  dropdown_formfield: ^0.1.3
  shared_preferences: ^0.5.12
  share: ^0.6.5+3
  autocomplete_textfield: ^1.7.3
  otp_text_field: ^1.0.1
  firebase_database: ^4.0.0
  firebase_core: ^0.5.0
  audioplayers: ^0.16.1

  agora_rtc_engine: ^3.3.1
  permission_handler: ^5.0.1
  audio_manager: ^0.5.5+3

  after_layout: ^1.0.7+2
  geocoder: ^0.2.1
  geolocator:
  webview_flutter: ^1.0.5
  location_web: ^1.0.0

  image_picker: ^0.6.7+11
  dio: ^3.0.10
  path_provider: ^1.6.18

  path:
  sizer: ^1.1.8

  # For Calender
  calendar_timeline: ^0.7.1
  fluttertoast: ^8.0.6

#  flutter_webview_plugin: ^0.3.11
  maps_launcher: ^2.0.0
  url_launcher: ^6.0.3
  flutter_email_sender: ^5.0.0
  pin_code_fields: ^7.0.0

  firebase_messaging:
  flutter_local_notifications: ^3.0.1+7

  flutter_inappwebview: ^4.0.0+4
  flutter_downloader: ^1.5.2

  animated_text_kit: ^4.2.1
  expand_widget: ^2.1.0
  flutter_html: any
  launch_review: ^3.0.1
  package_info: ^2.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: "^0.8.1"
  flutter_lints: ^1.0.0
flutter_icons:
  image_path: "icon/icon.png"
  android: true
  ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/
    - assets/images/insurance/enbn/
    - assets/images/dochome/english/
    - assets/images/dochome/bangla/
    - assets/images/patienthome/english/
    - assets/images/patienthome/bangla/
    - assets/images/pharmacyhome/english/
    - assets/images/pharmacyhome/bangla/
    - assets/images/providerhome/english/
    - assets/images/providerhome/bangla/
    - assets/images/providerservices/
    - assets/images/auth/bangla/
    - assets/images/auth/english/
    - assets/images/mdmt/
    - assets/images/newicons/
    - assets/ringtone.mp3
    - assets/calling.mp3
    - i18n/en.json
    - i18n/bn.json
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: Century Gothic
      fonts:
        - asset: assets/fonts/Century-Gothic.ttf
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

但没有任何效果。 现在仍然显示此错误:

ABIR appnameexample %flutter run  
Running "flutter pub get" in appnameexample...                            3.0s
The plugin `geocoder` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android
V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated
APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on M2010J19SI in debug mode...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audio_manager-0.5.7+1/android/src/main/java/cc/dync/audio_manager/AudioManagerPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.5.3/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:18: warning: [deprecation] Registrar in PluginRegistry has been deprecated
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:26: warning: [deprecation] Handler() in Handler has been deprecated
    private final Handler handler = new Handler();
                                    ^
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:31: warning: [deprecation] Registrar in PluginRegistry has been deprecated
    public static void registerWith(final Registrar registrar) {
                                          ^
3 warnings
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-3.0.3/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geocoder-0.2.1/android/src/main/java/com/aloisdeniel/geocoder/GeocoderPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.2.1/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java:10: warning: [deprecation] LocationProvider in android.location has been deprecated
import android.location.LocationProvider;
                       ^
error: warnings found and -Werror specified
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.2.1/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:29: warning: [deprecation] isFromMockProvider() in Location has been deprecated
      position.put("is_mocked", location.isFromMockProvider());
                                        ^
1 error
2 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':geolocator:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 56s
Running Gradle task 'assembleDebug'...                             57.6s
Exception: Gradle task assembleDebug failed with exit code 1
ABIR appnameexample %

我该如何解决此问题。请有人帮我解决这个问题。

This project build perfectly before January of this Year. But now it's show me error. First They show me location 16+ error. Then I changed the location package to geolocator. but not fixed.
Then create new project and import old code base.
and also change target and compilesdk to 31. and uncomment compileOptions

Here is my app level build.gradle-

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 31

    // compileOptions {
    //     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 "care.appnameexample.health"
        minSdkVersion 23
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation 'com.google.firebase:firebase-messaging:20.1.6'
}
apply plugin: 'com.google.gms.google-services'

Here is my pubspec.yaml file -

name: appnameexample
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"  // Environment changed after transfer to new project

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  curved_navigation_bar: ^0.3.3
  animations: ^1.1.2
  auto_size_text: ^2.1.0
  flutter_signin_button: ^1.1.0
  http: ^0.12.2
  progress_dialog: ^1.2.4
  intl: ^0.17.0
  chips_choice: ^1.4.1
  rflutter_alert: ^1.1.0
  provider: ^4.3.2+2
  fluid_bottom_nav_bar: ^1.1.1
  dropdown_formfield: ^0.1.3
  shared_preferences: ^0.5.12
  share: ^0.6.5+3
  autocomplete_textfield: ^1.7.3
  otp_text_field: ^1.0.1
  firebase_database: ^4.0.0
  firebase_core: ^0.5.0
  audioplayers: ^0.16.1

  agora_rtc_engine: ^3.3.1
  permission_handler: ^5.0.1
  audio_manager: ^0.5.5+3

  after_layout: ^1.0.7+2
  geocoder: ^0.2.1
  geolocator:
  webview_flutter: ^1.0.5
  location_web: ^1.0.0

  image_picker: ^0.6.7+11
  dio: ^3.0.10
  path_provider: ^1.6.18

  path:
  sizer: ^1.1.8

  # For Calender
  calendar_timeline: ^0.7.1
  fluttertoast: ^8.0.6

#  flutter_webview_plugin: ^0.3.11
  maps_launcher: ^2.0.0
  url_launcher: ^6.0.3
  flutter_email_sender: ^5.0.0
  pin_code_fields: ^7.0.0

  firebase_messaging:
  flutter_local_notifications: ^3.0.1+7

  flutter_inappwebview: ^4.0.0+4
  flutter_downloader: ^1.5.2

  animated_text_kit: ^4.2.1
  expand_widget: ^2.1.0
  flutter_html: any
  launch_review: ^3.0.1
  package_info: ^2.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: "^0.8.1"
  flutter_lints: ^1.0.0
flutter_icons:
  image_path: "icon/icon.png"
  android: true
  ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/
    - assets/images/insurance/enbn/
    - assets/images/dochome/english/
    - assets/images/dochome/bangla/
    - assets/images/patienthome/english/
    - assets/images/patienthome/bangla/
    - assets/images/pharmacyhome/english/
    - assets/images/pharmacyhome/bangla/
    - assets/images/providerhome/english/
    - assets/images/providerhome/bangla/
    - assets/images/providerservices/
    - assets/images/auth/bangla/
    - assets/images/auth/english/
    - assets/images/mdmt/
    - assets/images/newicons/
    - assets/ringtone.mp3
    - assets/calling.mp3
    - i18n/en.json
    - i18n/bn.json
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: Century Gothic
      fonts:
        - asset: assets/fonts/Century-Gothic.ttf
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

But Nothing is worked.
Still now It's show me this error :

ABIR appnameexample %flutter run  
Running "flutter pub get" in appnameexample...                            3.0s
The plugin `geocoder` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android
V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated
APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on M2010J19SI in debug mode...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audio_manager-0.5.7+1/android/src/main/java/cc/dync/audio_manager/AudioManagerPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.5.3/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:18: warning: [deprecation] Registrar in PluginRegistry has been deprecated
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:26: warning: [deprecation] Handler() in Handler has been deprecated
    private final Handler handler = new Handler();
                                    ^
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.16.2/android/src/main/java/xyz/luan/audioplayers/AudioplayersPlugin.java:31: warning: [deprecation] Registrar in PluginRegistry has been deprecated
    public static void registerWith(final Registrar registrar) {
                                          ^
3 warnings
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-3.0.3/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geocoder-0.2.1/android/src/main/java/com/aloisdeniel/geocoder/GeocoderPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.2.1/android/src/main/java/com/baseflow/geolocator/location/LocationManagerClient.java:10: warning: [deprecation] LocationProvider in android.location has been deprecated
import android.location.LocationProvider;
                       ^
error: warnings found and -Werror specified
/usr/local/Caskroom/flutter/2.0.2/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.2.1/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:29: warning: [deprecation] isFromMockProvider() in Location has been deprecated
      position.put("is_mocked", location.isFromMockProvider());
                                        ^
1 error
2 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':geolocator:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 56s
Running Gradle task 'assembleDebug'...                             57.6s
Exception: Gradle task assembleDebug failed with exit code 1
ABIR appnameexample %

How Can I fixed this. Please someone help me to fixed this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尾戒 2025-01-19 02:18:21

@abir-ashan 在我的例子中,此类问题已通过将“geolocator”从 6.2.1 升级到更新版本来解决

% flutter pub outdated
% flutter pub upgrade --major-versions

@abir-ashan in my case such issue like this was fixed with upgrading 'geolocator' from 6.2.1 to newer version

% flutter pub outdated
% flutter pub upgrade --major-versions
莫多说 2025-01-19 02:18:21

我遇到了同样的问题并尝试了很多解决方案,但最终通过执行以下更改解决了问题

安卓>应用程序>源代码>构建.gradle

    android {
       compileSdkVersion 31

       defaultConfig {
          minSdkVersion 21
          targetSdkVersion 29
       }
    }

I got the same issue and tried many solution, but finally the issue was solved by doing the following changes in

android > app > src > build.gradle

    android {
       compileSdkVersion 31

       defaultConfig {
          minSdkVersion 21
          targetSdkVersion 29
       }
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文