1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.android:facebook-android-sdk:latest.release.
     Required by:
         project :app
      > 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 2m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

this is the error I get while running the application

i tried adding mavenCentral() in my build.gradle file as some of the suggestions out there but it didn't work for me. I also tried

 implementation 'com.facebook.android:facebook-android-sdk:latest.release'

but it's still the same

sachin
  • 13
  • 4

4 Answers4

1

I've got the same problem now and I found that there was an outage with a jcenter :

https://status.gradle.com/

Pavlo Trinko
  • 25
  • 1
  • 6
0

as a temperary measure,

I suggest using this

allprojects {
    repositories {
        // Jcenter mirror
        maven { url "https://maven.aliyun.com/repository/jcenter" }
        // other repo
    }
}

or other mirror

--- Update ---

In other way

allprojects {
    repositories {
        all { ArtifactRepository repo ->
            if (repo instanceof MavenArtifactRepository) {
                if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
                    remove repo
                    add(mavenCentral())
                }
            }
        }
    }
}

this code changes to mavenCentral url if jcenter url exists.

Goodham
  • 57
  • 7
0

Hi in your build.gradle you should not add implementation "com.facebook.android:facebook-login:15.0.2" because this plugin already define that dependency for you.

ref: https://github.com/darwin-morocho/flutter-facebook-auth/issues/301#issuecomment-1296944186

Remove this line from build.gradle: implementation 'com.facebook.android:facebook-android-sdk:latest.release'

Mihir Joshi
  • 107
  • 5
0

From Hours of research if finally found that. this is an issue due to jcenter is down. According to official documentation the jcenter depricated and Bintray/JCenter users should start migrating to a new hosting solution. the solution for this is to remove jcenter from build file and replace it with

mavenCentral() // <- add it

for react-native users jcenter() may be exists in some depedency that you installed recently. to check for jcenter open your project in android-studio to check all build.gradle files easliy.

Another solution for this is that disconnect your system from internet and build your project. after you lanuc your project reconnect your system to internet.

Engr.Aftab Ufaq
  • 3,356
  • 3
  • 21
  • 47