Salavat Asadullin
Salavat Asadullin

Reputation: 21

Problems with Firebase initialization (android-java)

I want to initialize a Firebase, but I got some problems.

This is the text of an error:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.

Here is the project build.gradle code:

buildscript {
repositories {
    google()  // Google's Maven repository

}
dependencies {
    classpath 'com.google.gms:google-services:4.3.10'
    classpath 'com.android.tools.build:gradle:4.0.2'
}
}

plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}

allprojects {
repositories {
    google()
}
}

The problem disappears when I delete google() from

allprojects {
repositories {
    google()
}
}

But when I delete google(), there is another error: GoogleSignIn.getLastSignedInAccount causes exception

There is also gradle error log:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task 
':app:dataBindingMergeDependencyArtifactsDebug'.
Could not resolve all files for configuration 
':app:debugCompileClasspath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
 Required by:
     project :app > androidx.navigation:navigation-fragment:2.4.0
     project :app > androidx.navigation:navigation-runtime:2.4.0
     project :app > androidx.navigation:navigation-common:2.4.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
 Required by:
     project :app > androidx.fragment:fragment:1.4.0
     project :app > androidx.fragment:fragment-ktx:1.4.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
 Required by:
     project :app > androidx.core:core-ktx:1.2.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
 Required by:
     project :app > androidx.activity:activity-ktx:1.2.3
     project :app > androidx.lifecycle:lifecycle-livedata-core-ktx:2.3.1
     project :app > androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1
     project :app > androidx.savedstate:savedstate-ktx:1.1.0
     project :app > androidx.lifecycle:lifecycle-runtime-ktx:2.3.1
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
 Required by:
     project :app > androidx.collection:collection-ktx:1.1.0
Could not find org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1.
 Required by:
     project :app > androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1
     project :app > androidx.lifecycle:lifecycle-runtime-ktx:2.3.1

* 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 1s

Upvotes: 1

Views: 104

Answers (1)

Salavat Asadullin
Salavat Asadullin

Reputation: 21

The problem was solved by adding jcenter() to

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

I don't know why it's working, and why it didn't worked before. If you know why or you have another solution, please, answer.

Upvotes: 1

Related Questions