I have a project which I use Dagger2 & kotlin, I imported "org.jetbrains.kotlin:kotlin-stdlib:1.3.50”
in my build.gradle and I was getting this Error:
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
w: /Users/macbook/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.1.51/8b5933578dc55f32cfc1a25f1db6371e4161fb8f/kotlin-stdlib-jre7-1.1.51.jar: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead
So therefore I changed from "kotlin-stdlib"
to "kotlin-stdlib-jdk7"
using:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50”
and I am still getting this error.
I then made some research and found this URL: warning: Kotlin runtime JAR files in the classpath should have the same version
I found the usage of kotlin-reflect: "implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.50"
I added it to my build.gradle BUT I still have the same errors
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7: 1.3.50"
implementation "org.jetbrains.kotlin:kotlin-reflect: 1.3.50"
This is my BaseApplication class below, which I am calling the Dagger components :
class BaseApplication : Application() {
companion object {
@JvmStatic lateinit var netComponent: NetComponent
@JvmStatic lateinit var exampleComponent: ExampleComponent
}
override fun onCreate() {
super.onCreate()
netComponent = DaggerNetComponent.builder()
.appModule(AppModule(this))
.netModule(NetModule())
.build()
exampleComponent = DaggerExampleComponent.builder()
.netComponent(netComponent)
.retrofitModule(RetrofitModule())
.exampleModule(ExampleModule(this))
.build()
}
}