Gradle warnings as Firebase depends on an old version of kotlin-stdlib
See original GitHub issue[READ] Step 1: Are you in the right place?
Directed here by Firebase support who said: “To help speed up the resolution of this, or for any workarounds, it’s best to report this directly in our GitHub page. Our SDK engineers are active here, and address SDK issues directly.”
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 4.1.2
- Firebase Component: Analytics
- Component version: com.google.firebase:firebase-bom:26.3.0
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
I have added Firebase Analytics to an Android Kotlin project following https://firebase.google.com/docs/android/setup and am getting the following Gradle warnings
> Task :app:compileDevDebugKotlin
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/transforms-2/files-2.1/f9706160f36f4b1c50ca735a03df5a43/jetified-kotlin-stdlib-jdk7-1.3.72.jar (version 1.3)
~/.gradle/caches/transforms-2/files-2.1/2375935a479cb58bb2fd38e1bf25c73f/jetified-kotlin-stdlib-1.4.21.jar (version 1.4)
~/.gradle/caches/transforms-2/files-2.1/e7981998c27f576366ef7eac00e0f4c9/jetified-kotlin-stdlib-common-1.4.21.jar (version 1.4)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
My Android project is using the latest Kotlin plugin and stdlib version:
In project gradle file
ext.kotlin_version = "1.4.21"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
In app gradle file
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
This also shows as a warning in Android Studio for the stdlib line “Plugin version (1.4.21) is not the same as library version (1.3.72)”
Running command
./gradlew -q dependencies app:dependencies --configuration devDebugCompileClasspath
I can see that Firebase is brining in an old version of stdlib, e.g.
| +--- com.google.firebase:firebase-common-ktx:19.3.0 -> 19.5.0
| | +--- androidx.annotation:annotation:1.1.0
| | +--- com.google.firebase:firebase-common:19.5.0 (*)
| | +--- com.google.firebase:firebase-components:16.1.0 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 -> 1.4.21 (*)
As I am using what your docs suggest and am not specifying Firebase library versions but am getting them from
implementation platform('com.google.firebase:firebase-bom:26.3.0')
I have no control over what is going on
Please fix to remove these version mismatch warnings
Also, if a temporary workaround is possible by e.g. adding an exclude to the app’s gradle file, please provide an example. The relevant lines are
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
Relevant Code:
Some other snippets of gradle in case they help
compileSdkVersion 30
buildToolsVersion "30.0.2"
...
minSdkVersion 23
targetSdkVersion 30
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
And standard gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top GitHub Comments
I had exactly the same problem. The issue seems now for me to be resolved. I use now: // Import the Firebase BoM implementation platform(‘com.google.firebase:firebase-bom:27.1.0’) implementation ‘com.google.firebase:firebase-analytics-ktx’ // Kotlin stdlib implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.0’ implementation “org.jetbrains.kotlin:kotlin-stdlib:1.5.0”
I invalidated the cache and rebuilt my project after I changed it.
I couldn’t figure out how to label this issue, so I’ve labeled it for a human to triage. Hang tight.