question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
oujecommented, May 7, 2021

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.

1reaction
google-oss-botcommented, Jan 29, 2021

I couldn’t figure out how to label this issue, so I’ve labeled it for a human to triage. Hang tight.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning "Kotlin plugin version is not the same as library ...
You no longer need to declare a dependency on the stdlib library in any Kotlin Gradle project, including a multiplatform one. The dependency...
Read more >
Kotlin version conflict when using Kotlin Gradle plugins in pre ...
Kotlin version conflict when using Kotlin Gradle plugins in pre-compiled script plugin : KT-41142.
Read more >
What's new in Kotlin 1.6.0
For Kotlin/JVM, starting with 1.6.0, the compiler can generate classes with a bytecode version corresponding to JVM 17. The new language version ......
Read more >
lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks ...
"build.gradle:13: Warning: A newer version of com.google.firebase:firebase-messaging than 10.2.1 is available: 11.0.0 [GradleDependency]\n" +.
Read more >
Past releases - Android Developers
This page lists the new features and improvements for each major release of past Android Studio and Android Gradle plugin releases. To see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found