flutter facebook_app_events cannot load dependency for Android

120 Views Asked by At

I am working on a Flutter App that contains the dependency facebook_app_events. It's been working completely fine so far, but now, out of NOTHING, stopped working for android.

When I build the app I get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkProdDebugAarMetadata'.
> Could not resolve all files for configuration ':app:prodDebugRuntimeClasspath'.
   > Could not resolve com.facebook.android:facebook-android-sdk:15.+.
     Required by:
         project :app > project :facebook_app_events
      > Failed to list versions for com.facebook.android:facebook-android-sdk.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
               > Read timed out

* 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 1m 55s
Exception: Gradle task assembleProdDebug failed with exit code 1

Here is my pubspec.yaml with all my dependencies:

name: <appname>
description: A new Flutter project.

publish_to: 'none'
version: 2.0.1+1

environment:
  sdk: ">=2.16.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # common
  app_tracking_transparency: ^2.0.2+1
  checkdigit: ^0.3.1
  copy_with_extension: ^4.0.4
  crypto: ^3.0.1
  facebook_app_events: ^0.18.0
  fimber_io: ^0.6.4
  flutter_native_timezone: ^2.0.0
  flutter_vibrate: ^1.3.0
  in_app_review: ^2.0.3
  intl: ^0.17.0
  mobile_scanner: ^2.0.0
  package_info_plus: ^1.2.1
  purchases_flutter: ^3.9.2
  rating_dialog: ^2.0.3
  tuple: ^2.0.0
  url_launcher: ^6.0.17
  uuid: ^3.0.4
  screenshot: ^1.2.3
  path_provider: ^2.0.11
  share_plus: ^4.1.0
  video_player: ^2.4.7
  chewie: ^1.3.5

  # social login
  sign_in_with_apple: ^3.2.0
  flutter_login_facebook: ^1.6.1
  google_sign_in: ^5.4.2

  # firebase
  firebase_analytics: ^9.0.4
  firebase_crashlytics: ^2.4.4
  firebase_auth: ^3.0.2

  # networking
  fresh_dio: ^0.3.1
  json_annotation: ^4.4.0
  json_serializable: any
  logger: any  #for logging purpose
  pretty_dio_logger: ^1.1.1
  retrofit: any
  uni_links: ^0.5.1

  # state management
  get: ^4.6.1

  # storage
  get_storage: ^2.0.3

  # ui
  adaptive_dialog: ^1.1.0
  cached_network_image: ^3.2.0
  expandable: ^5.0.1
  flutter_svg: ^1.0.0
  readmore: ^2.1.0
  reorderables: ^0.4.2
  swipeable_tile: ^0.0.2
  percent_indicator: ^4.0.1
  carousel_slider: ^4.1.1
  tutorial_coach_mark: ^1.2.4
  bubble: ^1.2.1
  animated_text_kit: ^4.2.2
  auto_size_text: ^3.0.0
  fl_chart: ^0.55.1
  font_awesome_flutter: ^10.2.1

dependency_overrides:
  platform: ^3.1.0
  firebase_core_platform_interface: 4.5.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  build_runner: any
  copy_with_extension_gen: ^4.0.4
  flutter_launcher_icons: ^0.9.2
  retrofit_generator: ^4.2.0

flutter:
  uses-material-design: true

project/build.gradle:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    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.8'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

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

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

I have been trying to figure this out for hours, and nothing has worked so far. I tried using another version of the dependency, adding the dependency manually in the app/build.gradle, using different flutter versions. Nothing worked.

1

There are 1 best solutions below

0
ibhavikmakwana On

It was JCenter which was down and causing an error while downloading the Facebook Android dependencies.

Your app should absolutely work fine in the iOS device/simulator If Android is still not working.

You can check the status of the Gradle here.

status.gradle.com