Android Studio shows Kotlin Dependency Warning after Second Buildwarning: Kotlin runtime JAR files in the classpath should have the same versionWhy do I have different versions of Kotlin JARs in the classpath?How to find dependencies of library?Unable to resolve dependencies for assembleAndroidTest task with Android Gradle plugin 3.0.1Android Studio: Add jar as library?How to manually include external aar package using new Gradle Android Build SystemWhat is Gradle in Android Studio?Rename package in Android StudioWhere do I place the 'assets' folder in Android Studio?Outdated Kotlin Runtime warning in Android Studiokotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 insteadAbout Android StudioAPI 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()Kotlin the compiler warning and application cannot be executed

Why is a road bike faster than a city bike with the same effort? How much faster it can be?

Is it acceptable to say that a reviewer's concern is not going to be addressed because then the paper would be too long?

Medic abilities

How do we know neutrons have no charge?

Comma Code - Automate the Boring Stuff with Python

New road bike: alloy dual pivot brakes work poorly

Algorithm that generates orthogonal vectors: C++ implementation

Clear text passwords in Unix

Is there a concept of "peer review" in Rabbinical Judaism?

What is the white pattern on trim wheel for?

Neural Network vs regression

Can someone give the intuition behind Mean Absolute Error and the Median?

What exactly did this mechanic sabotage on the American Airlines 737, and how dangerous was it?

Is it ok if I haven't decided my research topic when I first meet with a potential phd advisor?

My Project Manager does not accept carry-over in Scrum, Is that normal?

Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?

What does Sartre mean by "pédéraste" - pederast or homosexual?

Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?

MaxDetect speed

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

Whaling ship logistics

Is a PWM required for regenerative braking on a DC Motor?

Top off gas with old oil, is that bad?

Align all symbols in a LaTeX equation



Android Studio shows Kotlin Dependency Warning after Second Build


warning: Kotlin runtime JAR files in the classpath should have the same versionWhy do I have different versions of Kotlin JARs in the classpath?How to find dependencies of library?Unable to resolve dependencies for assembleAndroidTest task with Android Gradle plugin 3.0.1Android Studio: Add jar as library?How to manually include external aar package using new Gradle Android Build SystemWhat is Gradle in Android Studio?Rename package in Android StudioWhere do I place the 'assets' folder in Android Studio?Outdated Kotlin Runtime warning in Android Studiokotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 insteadAbout Android StudioAPI 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()Kotlin the compiler warning and application cannot be executed






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








7















I've just enabled Kotlin in my Android project and I stumbled upon a warning. After the second build (Build -> Rebuild Project) this warning is shown under Messages:



Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d8089f1862215/kotlin-stdlib-jdk8-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.2.10/19bc012f8c4cd6b705bd6512263777cc19bcf259/kotlin-reflect-1.2.10.jar (version 1.2)
/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.51/kotlin-stdlib-jre7-1.1.51.jar (version 1.1)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10/cfe8b616b3bf0811ef70863c86b745a2e767a66e/kotlin-stdlib-jdk7-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10/b9bf650516989595a5390e5a54181e16347208ac/kotlin-stdlib-1.2.10.jar (version 1.2)


It seems like the second build includes the outdated kotlin-stdlib-jre7-1.1.51.jar from cache. After a clean build (Build -> Clean Project) the warning is gone, and the next Rebuild Project brings it up again.



I'm using Android Studio 3.0.1 and I explicitly include the Kotlin dependencies with version:



build.gradle



buildscript 
ext
// shared build properties
kotlin_version = '1.2.10'
buildToolsVersion = '27.0.2'
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 27

repositories
jcenter()
google()

dependencies
classpath "com.android.tools.build:gradle:3.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"




app/build.gradle



apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
[...]



Also on our travis builds the warning is shown. Thus, it is not only a problem with my local setup. Even if it is only a warning, I don't feel comfortable by releasing an apk that includes conflicting versions.










share|improve this question
























  • You can also check this for correct integrations plugins.gradle.org/plugin/…

    – Napolean
    Jan 4 '18 at 6:46

















7















I've just enabled Kotlin in my Android project and I stumbled upon a warning. After the second build (Build -> Rebuild Project) this warning is shown under Messages:



Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d8089f1862215/kotlin-stdlib-jdk8-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.2.10/19bc012f8c4cd6b705bd6512263777cc19bcf259/kotlin-reflect-1.2.10.jar (version 1.2)
/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.51/kotlin-stdlib-jre7-1.1.51.jar (version 1.1)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10/cfe8b616b3bf0811ef70863c86b745a2e767a66e/kotlin-stdlib-jdk7-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10/b9bf650516989595a5390e5a54181e16347208ac/kotlin-stdlib-1.2.10.jar (version 1.2)


It seems like the second build includes the outdated kotlin-stdlib-jre7-1.1.51.jar from cache. After a clean build (Build -> Clean Project) the warning is gone, and the next Rebuild Project brings it up again.



I'm using Android Studio 3.0.1 and I explicitly include the Kotlin dependencies with version:



build.gradle



buildscript 
ext
// shared build properties
kotlin_version = '1.2.10'
buildToolsVersion = '27.0.2'
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 27

repositories
jcenter()
google()

dependencies
classpath "com.android.tools.build:gradle:3.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"




app/build.gradle



apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
[...]



Also on our travis builds the warning is shown. Thus, it is not only a problem with my local setup. Even if it is only a warning, I don't feel comfortable by releasing an apk that includes conflicting versions.










share|improve this question
























  • You can also check this for correct integrations plugins.gradle.org/plugin/…

    – Napolean
    Jan 4 '18 at 6:46













7












7








7


2






I've just enabled Kotlin in my Android project and I stumbled upon a warning. After the second build (Build -> Rebuild Project) this warning is shown under Messages:



Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d8089f1862215/kotlin-stdlib-jdk8-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.2.10/19bc012f8c4cd6b705bd6512263777cc19bcf259/kotlin-reflect-1.2.10.jar (version 1.2)
/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.51/kotlin-stdlib-jre7-1.1.51.jar (version 1.1)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10/cfe8b616b3bf0811ef70863c86b745a2e767a66e/kotlin-stdlib-jdk7-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10/b9bf650516989595a5390e5a54181e16347208ac/kotlin-stdlib-1.2.10.jar (version 1.2)


It seems like the second build includes the outdated kotlin-stdlib-jre7-1.1.51.jar from cache. After a clean build (Build -> Clean Project) the warning is gone, and the next Rebuild Project brings it up again.



I'm using Android Studio 3.0.1 and I explicitly include the Kotlin dependencies with version:



build.gradle



buildscript 
ext
// shared build properties
kotlin_version = '1.2.10'
buildToolsVersion = '27.0.2'
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 27

repositories
jcenter()
google()

dependencies
classpath "com.android.tools.build:gradle:3.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"




app/build.gradle



apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
[...]



Also on our travis builds the warning is shown. Thus, it is not only a problem with my local setup. Even if it is only a warning, I don't feel comfortable by releasing an apk that includes conflicting versions.










share|improve this question














I've just enabled Kotlin in my Android project and I stumbled upon a warning. After the second build (Build -> Rebuild Project) this warning is shown under Messages:



Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d8089f1862215/kotlin-stdlib-jdk8-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.2.10/19bc012f8c4cd6b705bd6512263777cc19bcf259/kotlin-reflect-1.2.10.jar (version 1.2)
/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.51/kotlin-stdlib-jre7-1.1.51.jar (version 1.1)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10/cfe8b616b3bf0811ef70863c86b745a2e767a66e/kotlin-stdlib-jdk7-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10/b9bf650516989595a5390e5a54181e16347208ac/kotlin-stdlib-1.2.10.jar (version 1.2)


It seems like the second build includes the outdated kotlin-stdlib-jre7-1.1.51.jar from cache. After a clean build (Build -> Clean Project) the warning is gone, and the next Rebuild Project brings it up again.



I'm using Android Studio 3.0.1 and I explicitly include the Kotlin dependencies with version:



build.gradle



buildscript 
ext
// shared build properties
kotlin_version = '1.2.10'
buildToolsVersion = '27.0.2'
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 27

repositories
jcenter()
google()

dependencies
classpath "com.android.tools.build:gradle:3.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"




app/build.gradle



apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
[...]



Also on our travis builds the warning is shown. Thus, it is not only a problem with my local setup. Even if it is only a warning, I don't feel comfortable by releasing an apk that includes conflicting versions.







android android-studio android-gradle kotlin






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 15 '17 at 13:19









Tobias RohloffTobias Rohloff

381 silver badge7 bronze badges




381 silver badge7 bronze badges















  • You can also check this for correct integrations plugins.gradle.org/plugin/…

    – Napolean
    Jan 4 '18 at 6:46

















  • You can also check this for correct integrations plugins.gradle.org/plugin/…

    – Napolean
    Jan 4 '18 at 6:46
















You can also check this for correct integrations plugins.gradle.org/plugin/…

– Napolean
Jan 4 '18 at 6:46





You can also check this for correct integrations plugins.gradle.org/plugin/…

– Napolean
Jan 4 '18 at 6:46












2 Answers
2






active

oldest

votes


















9
















Summary



  1. You already fixed it updating your dependencies but I'll answer here to link a related question.


  2. You configured correctly your project dependencies and updated the Kotlin plugin to 1.2.


  3. This is normally enough like here but stdlib-jre dependencies were changed to jdk in Kotlin 1.2.


  4. But your project was depending on Realm version 4.3.1, and they fixed this in version 4.3.2.


  5. You can find the dependency causing the issue via commands or the new build tab in AS 3.1.



1. Add explicit dependencies and update dependencies



Extended versions of the Kotlin standard library are explained in documentation and this answer.




If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions.



Instead of kotlin-stdlib, use one of the following dependencies:



compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"


In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.




Update other dependencies, if the automatic resolution doesn't work properly (see point 5).




2. Configure Gradle and Kotlin plugin updates



Revise your Gradle configuration. In order to to build an Android project written in Kotlin:



  • Set up the kotlin-android gradle plugin and apply it to your project.

  • Add kotlin-stdlib dependencies.


Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:



Tools | Kotlin | Configure Kotlin in Project




enter image description here




Check for Kotlin plugin updates:



Tools | Kotlin | Configure Kotlin plugin updates




enter image description here




3. kotlin-stdlib-jre7 renamed to kotlin-stdlib-jdk7 during the 1.2.x release




Sirrah commented on 27 Dec 2017 here:



The Kotlin stdlib was renamed during the 1.2.x release. See here.



The old name kotlin-stdlib-jre7 was changed to kotlin-stdlib-jdk7.



This library is referenced in realm-library and kotlin-extensions.





4. Realm updated to Kotlin 1.2 in 4.3.2 version




Update Gradle Wrapper to 4.4.1 and Update to Kotlin
1.2
(#5642)



  • Update Gradle Wrapper and Update to Kotlin 1.2


  • kotlin-stdlib-jre7 -> kotlin-stdlib-jdk7




enter image description here




5. Find conflictive dependencies via command, or build tab since AS 3.1



./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath


enter image description here



Since Android Studio 3.1 Beta 1, you can use the new build tab to find the conflictive dependency:



enter image description here



enter image description here



enter image description here



In this case, you removed the warning and fixed the issue updating Realm version to 4.3.2:



enter image description here



enter image description here



It's also possible to check it in Travis-ci builds considering the order dependencies are downloaded:



enter image description here






share|improve this answer




















  • 1





    Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

    – Tobias Rohloff
    Feb 5 '18 at 8:28











  • @albodelu could you explain how to use the Build tab to find the conflicting dependency?

    – Nolan Amy
    Jul 28 '18 at 0:21






  • 1





    If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

    – xarlymg89
    Nov 27 '18 at 10:10


















1
















what you can also do is to simply remove(or move) extra version folders.
for example, remove one of the two folders below, then rebuild and that should get rid of the kotlin runtime warning.



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10






share|improve this answer

























  • Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

    – Bakhtiyor
    Aug 2 at 0:18














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47833237%2fandroid-studio-shows-kotlin-dependency-warning-after-second-build%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









9
















Summary



  1. You already fixed it updating your dependencies but I'll answer here to link a related question.


  2. You configured correctly your project dependencies and updated the Kotlin plugin to 1.2.


  3. This is normally enough like here but stdlib-jre dependencies were changed to jdk in Kotlin 1.2.


  4. But your project was depending on Realm version 4.3.1, and they fixed this in version 4.3.2.


  5. You can find the dependency causing the issue via commands or the new build tab in AS 3.1.



1. Add explicit dependencies and update dependencies



Extended versions of the Kotlin standard library are explained in documentation and this answer.




If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions.



Instead of kotlin-stdlib, use one of the following dependencies:



compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"


In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.




Update other dependencies, if the automatic resolution doesn't work properly (see point 5).




2. Configure Gradle and Kotlin plugin updates



Revise your Gradle configuration. In order to to build an Android project written in Kotlin:



  • Set up the kotlin-android gradle plugin and apply it to your project.

  • Add kotlin-stdlib dependencies.


Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:



Tools | Kotlin | Configure Kotlin in Project




enter image description here




Check for Kotlin plugin updates:



Tools | Kotlin | Configure Kotlin plugin updates




enter image description here




3. kotlin-stdlib-jre7 renamed to kotlin-stdlib-jdk7 during the 1.2.x release




Sirrah commented on 27 Dec 2017 here:



The Kotlin stdlib was renamed during the 1.2.x release. See here.



The old name kotlin-stdlib-jre7 was changed to kotlin-stdlib-jdk7.



This library is referenced in realm-library and kotlin-extensions.





4. Realm updated to Kotlin 1.2 in 4.3.2 version




Update Gradle Wrapper to 4.4.1 and Update to Kotlin
1.2
(#5642)



  • Update Gradle Wrapper and Update to Kotlin 1.2


  • kotlin-stdlib-jre7 -> kotlin-stdlib-jdk7




enter image description here




5. Find conflictive dependencies via command, or build tab since AS 3.1



./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath


enter image description here



Since Android Studio 3.1 Beta 1, you can use the new build tab to find the conflictive dependency:



enter image description here



enter image description here



enter image description here



In this case, you removed the warning and fixed the issue updating Realm version to 4.3.2:



enter image description here



enter image description here



It's also possible to check it in Travis-ci builds considering the order dependencies are downloaded:



enter image description here






share|improve this answer




















  • 1





    Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

    – Tobias Rohloff
    Feb 5 '18 at 8:28











  • @albodelu could you explain how to use the Build tab to find the conflicting dependency?

    – Nolan Amy
    Jul 28 '18 at 0:21






  • 1





    If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

    – xarlymg89
    Nov 27 '18 at 10:10















9
















Summary



  1. You already fixed it updating your dependencies but I'll answer here to link a related question.


  2. You configured correctly your project dependencies and updated the Kotlin plugin to 1.2.


  3. This is normally enough like here but stdlib-jre dependencies were changed to jdk in Kotlin 1.2.


  4. But your project was depending on Realm version 4.3.1, and they fixed this in version 4.3.2.


  5. You can find the dependency causing the issue via commands or the new build tab in AS 3.1.



1. Add explicit dependencies and update dependencies



Extended versions of the Kotlin standard library are explained in documentation and this answer.




If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions.



Instead of kotlin-stdlib, use one of the following dependencies:



compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"


In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.




Update other dependencies, if the automatic resolution doesn't work properly (see point 5).




2. Configure Gradle and Kotlin plugin updates



Revise your Gradle configuration. In order to to build an Android project written in Kotlin:



  • Set up the kotlin-android gradle plugin and apply it to your project.

  • Add kotlin-stdlib dependencies.


Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:



Tools | Kotlin | Configure Kotlin in Project




enter image description here




Check for Kotlin plugin updates:



Tools | Kotlin | Configure Kotlin plugin updates




enter image description here




3. kotlin-stdlib-jre7 renamed to kotlin-stdlib-jdk7 during the 1.2.x release




Sirrah commented on 27 Dec 2017 here:



The Kotlin stdlib was renamed during the 1.2.x release. See here.



The old name kotlin-stdlib-jre7 was changed to kotlin-stdlib-jdk7.



This library is referenced in realm-library and kotlin-extensions.





4. Realm updated to Kotlin 1.2 in 4.3.2 version




Update Gradle Wrapper to 4.4.1 and Update to Kotlin
1.2
(#5642)



  • Update Gradle Wrapper and Update to Kotlin 1.2


  • kotlin-stdlib-jre7 -> kotlin-stdlib-jdk7




enter image description here




5. Find conflictive dependencies via command, or build tab since AS 3.1



./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath


enter image description here



Since Android Studio 3.1 Beta 1, you can use the new build tab to find the conflictive dependency:



enter image description here



enter image description here



enter image description here



In this case, you removed the warning and fixed the issue updating Realm version to 4.3.2:



enter image description here



enter image description here



It's also possible to check it in Travis-ci builds considering the order dependencies are downloaded:



enter image description here






share|improve this answer




















  • 1





    Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

    – Tobias Rohloff
    Feb 5 '18 at 8:28











  • @albodelu could you explain how to use the Build tab to find the conflicting dependency?

    – Nolan Amy
    Jul 28 '18 at 0:21






  • 1





    If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

    – xarlymg89
    Nov 27 '18 at 10:10













9














9










9









Summary



  1. You already fixed it updating your dependencies but I'll answer here to link a related question.


  2. You configured correctly your project dependencies and updated the Kotlin plugin to 1.2.


  3. This is normally enough like here but stdlib-jre dependencies were changed to jdk in Kotlin 1.2.


  4. But your project was depending on Realm version 4.3.1, and they fixed this in version 4.3.2.


  5. You can find the dependency causing the issue via commands or the new build tab in AS 3.1.



1. Add explicit dependencies and update dependencies



Extended versions of the Kotlin standard library are explained in documentation and this answer.




If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions.



Instead of kotlin-stdlib, use one of the following dependencies:



compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"


In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.




Update other dependencies, if the automatic resolution doesn't work properly (see point 5).




2. Configure Gradle and Kotlin plugin updates



Revise your Gradle configuration. In order to to build an Android project written in Kotlin:



  • Set up the kotlin-android gradle plugin and apply it to your project.

  • Add kotlin-stdlib dependencies.


Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:



Tools | Kotlin | Configure Kotlin in Project




enter image description here




Check for Kotlin plugin updates:



Tools | Kotlin | Configure Kotlin plugin updates




enter image description here




3. kotlin-stdlib-jre7 renamed to kotlin-stdlib-jdk7 during the 1.2.x release




Sirrah commented on 27 Dec 2017 here:



The Kotlin stdlib was renamed during the 1.2.x release. See here.



The old name kotlin-stdlib-jre7 was changed to kotlin-stdlib-jdk7.



This library is referenced in realm-library and kotlin-extensions.





4. Realm updated to Kotlin 1.2 in 4.3.2 version




Update Gradle Wrapper to 4.4.1 and Update to Kotlin
1.2
(#5642)



  • Update Gradle Wrapper and Update to Kotlin 1.2


  • kotlin-stdlib-jre7 -> kotlin-stdlib-jdk7




enter image description here




5. Find conflictive dependencies via command, or build tab since AS 3.1



./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath


enter image description here



Since Android Studio 3.1 Beta 1, you can use the new build tab to find the conflictive dependency:



enter image description here



enter image description here



enter image description here



In this case, you removed the warning and fixed the issue updating Realm version to 4.3.2:



enter image description here



enter image description here



It's also possible to check it in Travis-ci builds considering the order dependencies are downloaded:



enter image description here






share|improve this answer













Summary



  1. You already fixed it updating your dependencies but I'll answer here to link a related question.


  2. You configured correctly your project dependencies and updated the Kotlin plugin to 1.2.


  3. This is normally enough like here but stdlib-jre dependencies were changed to jdk in Kotlin 1.2.


  4. But your project was depending on Realm version 4.3.1, and they fixed this in version 4.3.2.


  5. You can find the dependency causing the issue via commands or the new build tab in AS 3.1.



1. Add explicit dependencies and update dependencies



Extended versions of the Kotlin standard library are explained in documentation and this answer.




If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions.



Instead of kotlin-stdlib, use one of the following dependencies:



compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"


In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.




Update other dependencies, if the automatic resolution doesn't work properly (see point 5).




2. Configure Gradle and Kotlin plugin updates



Revise your Gradle configuration. In order to to build an Android project written in Kotlin:



  • Set up the kotlin-android gradle plugin and apply it to your project.

  • Add kotlin-stdlib dependencies.


Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:



Tools | Kotlin | Configure Kotlin in Project




enter image description here




Check for Kotlin plugin updates:



Tools | Kotlin | Configure Kotlin plugin updates




enter image description here




3. kotlin-stdlib-jre7 renamed to kotlin-stdlib-jdk7 during the 1.2.x release




Sirrah commented on 27 Dec 2017 here:



The Kotlin stdlib was renamed during the 1.2.x release. See here.



The old name kotlin-stdlib-jre7 was changed to kotlin-stdlib-jdk7.



This library is referenced in realm-library and kotlin-extensions.





4. Realm updated to Kotlin 1.2 in 4.3.2 version




Update Gradle Wrapper to 4.4.1 and Update to Kotlin
1.2
(#5642)



  • Update Gradle Wrapper and Update to Kotlin 1.2


  • kotlin-stdlib-jre7 -> kotlin-stdlib-jdk7




enter image description here




5. Find conflictive dependencies via command, or build tab since AS 3.1



./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath


enter image description here



Since Android Studio 3.1 Beta 1, you can use the new build tab to find the conflictive dependency:



enter image description here



enter image description here



enter image description here



In this case, you removed the warning and fixed the issue updating Realm version to 4.3.2:



enter image description here



enter image description here



It's also possible to check it in Travis-ci builds considering the order dependencies are downloaded:



enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 3 '18 at 17:05









albodelualbodelu

6,6853 gold badges27 silver badges73 bronze badges




6,6853 gold badges27 silver badges73 bronze badges










  • 1





    Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

    – Tobias Rohloff
    Feb 5 '18 at 8:28











  • @albodelu could you explain how to use the Build tab to find the conflicting dependency?

    – Nolan Amy
    Jul 28 '18 at 0:21






  • 1





    If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

    – xarlymg89
    Nov 27 '18 at 10:10












  • 1





    Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

    – Tobias Rohloff
    Feb 5 '18 at 8:28











  • @albodelu could you explain how to use the Build tab to find the conflicting dependency?

    – Nolan Amy
    Jul 28 '18 at 0:21






  • 1





    If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

    – xarlymg89
    Nov 27 '18 at 10:10







1




1





Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

– Tobias Rohloff
Feb 5 '18 at 8:28





Thanks for your extensive explanation. I didn't know Realm bundled Kotlin dependencies as well. The command for conflictive dependencies comes in handy for such cases.

– Tobias Rohloff
Feb 5 '18 at 8:28













@albodelu could you explain how to use the Build tab to find the conflicting dependency?

– Nolan Amy
Jul 28 '18 at 0:21





@albodelu could you explain how to use the Build tab to find the conflicting dependency?

– Nolan Amy
Jul 28 '18 at 0:21




1




1





If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

– xarlymg89
Nov 27 '18 at 10:10





If I sun the gradlew to find which dependencies are creating conflicts, I get this error "Configuration with name 'variantDebugCompileClasspath' not found." Any help with this? I'm unable to get rid of this issue.

– xarlymg89
Nov 27 '18 at 10:10













1
















what you can also do is to simply remove(or move) extra version folders.
for example, remove one of the two folders below, then rebuild and that should get rid of the kotlin runtime warning.



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10






share|improve this answer

























  • Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

    – Bakhtiyor
    Aug 2 at 0:18
















1
















what you can also do is to simply remove(or move) extra version folders.
for example, remove one of the two folders below, then rebuild and that should get rid of the kotlin runtime warning.



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10






share|improve this answer

























  • Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

    – Bakhtiyor
    Aug 2 at 0:18














1














1










1









what you can also do is to simply remove(or move) extra version folders.
for example, remove one of the two folders below, then rebuild and that should get rid of the kotlin runtime warning.



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10






share|improve this answer













what you can also do is to simply remove(or move) extra version folders.
for example, remove one of the two folders below, then rebuild and that should get rid of the kotlin runtime warning.



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10



~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 18:37









JamieJamie

113 bronze badges




113 bronze badges















  • Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

    – Bakhtiyor
    Aug 2 at 0:18


















  • Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

    – Bakhtiyor
    Aug 2 at 0:18

















Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

– Bakhtiyor
Aug 2 at 0:18






Simply removing .gradle/caches/folder-name folder resolved my problem. Thanks @Jamie

– Bakhtiyor
Aug 2 at 0:18



















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47833237%2fandroid-studio-shows-kotlin-dependency-warning-after-second-build%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript