Lance Samaria
Lance Samaria

Reputation: 19572

Failed to resolve: com.google.firebase:firebase-bom:31.0.0

I'm using Android Studio Dolphin 2021.3.1 Patch 2, Gradle 7.5.1, Android Gradle Plugin Version 7.3.1, Build Tools 33.0.0, SDK 32. The current stable Gradle release is 7.5.1.

It appears that the recent Firebase bom update from 30.5.0 to 31.0.0 has issues. Does anyone know a fix?

About a week ago I started working on a Kotlin project and added Firebase Auth to it, everything worked fine:

dependencies {
    implementation platform('com.google.firebase:firebase-bom:30.5.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth-ktx'
}

Today I had to include the Storage and RealTimeDatabase. I go to the Storage SDK, it says to add:

dependencies {
    implementation platform('com.google.firebase:firebase-bom:31.0.0')
    implementation 'com.google.firebase:firebase-storage-ktx'
    implementation 'com.google.firebase:firebase-database-ktx'
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth-ktx'
}

When I sync, I get warnings:

Failed to resolve: com.google.firebase:firebase-bom:31.0.0

Failed to resolve: com.google.firebase:firebase-analytics

Failed to resolve: com.google.firebase:firebase-auth-ktx

Failed to resolve: com.google.firebase:firebase-storage-ktx

Failed to resolve: com.google.firebase:firebase-database-ktx

enter image description here

Once I build, it fails, inside the project I get:

Cause: unable to find valid certification path to requested target

enter image description here

The odd thing is once I revert back to bom:30.5.0 and only use firebase-analyticss && firebase-auth-ktx everything works fine.

UPDATE I got the most recent version numbers from here and tried to sync the below but the same issued occurred:

dependencies {
    implementation platform('com.google.firebase:firebase-bom:31.0.0')
    implementation 'com.google.firebase:firebase-storage-ktx:20.1.0'
    implementation 'com.google.firebase:firebase-database-ktx:20.1.0'
    implementation 'com.google.firebase:firebase-analytics:21.2.0'
    implementation 'com.google.firebase:firebase-auth-ktx:21.1.0'
}

I've filed this same bug to the firebase-android-sdk gitbub

Upvotes: 2

Views: 6946

Answers (1)

Lance Samaria
Lance Samaria

Reputation: 19572

This issue was cause by:

Cause: unable to find valid certification path to requested target

To dig deeper into the issue, I went inside Android Studio (not your mac), at the bottom I opened Terminal and entered: ./gradlew build --warning-mode all

The exact problem was:

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

To fix the issue I found the answer here by @Sadegh

I went to Gradle Scripts > gradle.properties. Inside the gradle.properties file paste the below 6 lines from his answer:

// ...

systemProp.http.proxyHost=fodev.org
systemProp.http.proxyPort=8118
systemProp.http.nonProxyHosts=*.jitpack.io, *.maven.org
systemProp.https.proxyHost=fodev.org
systemProp.https.proxyPort=8118
systemProp.https.nonProxyHosts=*.jitpack.io, *.maven.org

Upvotes: 2

Related Questions