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

发布于 2025-01-12 03:26:32 字数 5034 浏览 2 评论 0原文

我快要疯了,因为三天前我就想解决这个问题:)任何人都可以帮助我。 注意:该应用程序已在 Google Play 上发布,现在我正在开发应用程序的第 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

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

Flutter 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

这是来自我的应用程序/构建.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
}

I'm going crazy because I'm trying to solve this from 3 days ago :) any one can please help me.
Note: the app is already on google play, now I'm working on version 2 of app.

I'm trying to add Facebook Authentication to an existing flutter app, i was add the package to pubspec.yaml file, and doing all configuration from official docs.
now when trying to debug its show error :

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

Here is some details about project:

Flutter pubspec.yaml file :

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

this is from my app/build.gradle file :

 minSdkVersion 19
        targetSdkVersion 30

and this from 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
}

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

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

发布评论

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

评论(1

¢好甜 2025-01-19 03:26:32

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

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

Try adding maven { url 'https://maven.google.com' } to your build script repositories:

 repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        google()
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文