将 Facebook 身份验证添加到 flutter App 时出错

Error when adding Facebook Authentication to flutter App

我快要疯了,因为我试图从 3 天前解决这个问题 :) 任何人都可以帮助我。 注意:应用程序已经在 google 播放,现在我正在开发应用程序的第 2 版。

我正在尝试将 Facebook 身份验证添加到现有的 flutter 应用程序,我将包添加到 pubspec.yaml 文件,并从官方文档进行所有配置。 现在在尝试调试其显示错误时:

Execution failed for task ':flutter_facebook_auth:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':flutter_facebook_auth:debugCompileClasspath'.
   > Could not find lifecycle-common-2.3.0.jar (androidx.lifecycle:lifecycle-common:2.3.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-common/2.3.0/lifecycle-common-2.3.0.jar

以下是有关项目的一些详细信息:

颤动pubspec.yaml 文件:

name: red_gold
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `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.4+3

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  get: ^4.3.8
  flutter_secure_storage: ^5.0.2
  shared_preferences: ^2.0.7
  http: ^0.13.3
  dio: ^4.0.0
  image_cropper: ^1.4.1
  image_picker: ^0.8.4+2
  flutter_easyloading: ^3.0.3
  retry: ^3.1.0
  cached_network_image: ^3.1.0
  flutter_switch: ^0.3.2
  get_storage: ^2.0.3
  flutter_html: ^2.1.4
  flutter_facebook_auth: ^4.1.1




dev_dependencies:
  flutter_lints: ^1.0.4
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: "^0.9.2"

flutter_icons:
  android: true
  ios: true
  image_path: "assets/images/Logo.png"



# 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/

  # 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: ACaslon Bold
     fonts:
       - asset: assets/fonts/ACaslonPro-Bold.otf
       - asset: assets/fonts/ACaslonPro-BoldItalic.otf
         style: italic
   - family: Acaslon SemiBold
     fonts:
       - asset: assets/fonts/ACaslonPro-SemiBold.otf
       - asset: assets/fonts/ACaslonPro-SemiBoldItalic.otf
         style: italic
   - family: Acaslon Regular
     fonts:
       - asset: assets/fonts/ACaslonPro-Regular.otf

  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

这是我的 app/build.gradle 文件 :

 minSdkVersion 19
        targetSdkVersion 30

这来自 android/build/gradle:

buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
        classpath 'com.android.support:multidex:1.0.3'


    }
}

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

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

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

尝试将 Maven { url 'https://maven.google.com' } 添加到您的构建脚本存储库:

 repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        google()
    }