Android Studio에서 오래된 Kotlin 런타임 경고
최신 Kotlin 플러그인을 다운로드하여 설치 한 후 Android Studio에서 Kotlin Runtime 경고 가 오래 되었다고 알려줍니다.
'kotlin-stdlib-1.1.2'라이브러리의 Kotlin 런타임 버전은 1.1.2이고 플러그인 버전은 1.1.2-release-Studio2.3-3입니다. 호환성 문제를 피하려면 런타임 라이브러리를 업데이트해야합니다.
런타임 업데이트 버튼 을 클릭 했지만 다른 메시지가 나타납니다.
Gradle 프로젝트의 자동 라이브러리 버전 업데이트는 현재 지원되지 않습니다. build.gradle을 수동으로 업데이트하십시오.
이 문제를 해결하는 방법?
프로젝트 레벨 build.gradle
파일 에서 Kotlin 버전을 업데이트 할 수 있습니다 . 일반적인 방법으로 구성한 경우 맨 위에 다음 줄이 있어야합니다.
ext.kotlin_version = '1.1.2'
플러그인과 일치하는 버전으로 업그레이드하려면이 줄을 다음과 같이 변경하십시오.
ext.kotlin_version = '1.1.2-3'
편집 (아래 질문에 응답) :
이 오류는 버전을 업그레이드해야한다는 것을 알려줍니다. 질문은 1.1.2-3
예를 들어 1.1.2-release-Studio2.3-3
.
Kotlin의 최신 버전을 찾는 가장 좋은 방법은 kotlinlang.org 로 이동하여 "최신 버전"을 찾는 것입니다. 첫 페이지에 있어야합니다.
이와 같이 버전 번호가 중요하지 않은 경우 수행 할 다른 작업은 버전이 호스팅되는 리포지토리를 확인하는 것입니다. 안드로이드의 경우, 아마도 jcenter에서 가져 와서 사용 가능한 모든 버전이 나열된 저장소 페이지를 찾을 수 있습니다.
여기 로 이동하여 파일이 실제로 호스팅되는 jcenter의 원시 maven 저장소를 탐색 하거나 mvnrepository 또는 mavencentral (후자의 원시 버전) 에서 Kotlin을 찾을 수도 있습니다 .
당신에 (Project: [projectName])
build.gradle
파일이 찾을 : ext.kotlin_version = 'x.x.x'
당신의 코 틀린 플러그인의 현재 버전 XXX 교체합니다.
Kotlin 플러그인의 현재 버전을 확인하려면 다음을 수행하십시오.
도구-> Kotlin-> Confugure Kotlin 플러그인 업데이트로 이동하십시오.
"다시 확인"을 클릭하십시오. 잠시 후 Kotlin 플러그인 버전이 표시됩니다. (최신이 아닌 경우 Kotlin 플러그인이 업데이트됩니다.)
주의 : 또한 (Module: app)
build.gradle
파일을 점검 하고 사용하지 않는지 확인하십시오 .
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.21"
그러나
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.40'
"... jre7 ..."-> "... jdk7 ..." 의 차이점에 유의하십시오 . 또한 "1.2.40"을 현재 Kotlin 플러그인 버전으로 바꾸십시오.
그것은 (Android Studio 3.0.1에서) 참조 된 라이브러리의 종속성으로 인해 불만을 제기했습니다.
'org.jetbrains.kotlin : kotlin-stdlib : 1.1.3@jar'라이브러리의 Kotlin 런타임 버전은 1.1.3이며 플러그인 버전은 1.1.51-release-Studio3.0-1입니다.
그런 다음 모듈 수준에서 필요한 버전으로 빌드를 시행했습니다 build.gradle
.
configurations.all() {
resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib:1.1.51'
}
결과는 다음과 같습니다.
./gradlew app:dependencies | grep kotlin
Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.51/kotlin-stdlib-1.1.51.pom
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 -> 1.1.51
...
업데이트 할 두 가지 부분이 있습니다.
- 프로젝트의 kotlin 런타임
- kotlin 플러그인
Ivo Stoyanov의 답변은 안드로이드 스튜디오 메뉴를 사용하여이를 수행하는 방법을 보여줍니다. 오류 메시지가 표시되어 (kotlin 플러그인 업데이트 중) 혼자 시도했지만 여전히 kotlin 런타임에 대해 불평했습니다. 다른 답변 중 일부에서 알 수 있듯이 ext.kotlin_version의 줄을 프로젝트 빌드 gradle에 추가하여 프로젝트별로 업데이트 할 수 있습니다. 그러나이를 위해서는 kotlin 런타임 버전을 알아야합니다. 또는 아래에 표시된 것처럼 메뉴를 통해 안드로이드 스튜디오에서 사용 가능한 버전을 표시하고 가장 최신 버전을 선택할 수 있습니다.
그런 다음 android studio는 프로젝트 빌드 gradle에 적절한 줄을 추가합니다.
ext.kotlin_version을 '1.1.2-4'에서 ext.kotlin_version = '1.1.2-5'로 변경하면 문제가 해결되었습니다.
the latest version of kotlin is 1.2.41 use this and syn your project.
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
As of March 8, 2019 the current kotlin version is '1.3.21'
Under build.gradle
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
cheers
This issue comes when you update the kotlin plugin version popped up from android studio, but issue is current version of Android studio is not able to dynamically change the kotlin gradle plugin which is located in your project level Build.gradle file.
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10"
}
How to solve this issue?
So you need to manually change this version, You can find that Here
buildscript {
ext.kotlin_version = '1.2.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
search for these two lines of code
ext.kotlin_version = '1.3.11'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
replace $kotlin_version with actual value (here it's 1.3.11)
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
after this your IDE will automatically suggest you the updated version
happy coding :)
I've run into this issue a few times in Android Studio and IDEA, found that if you go into your projects Gradle file and in your dependencies if you set the version of the kotlin-gradle-plugin
to $kotlin_version
then the warning message will tell you what version you need to set ext.kotlin_version
to.
buildscript {
ext.kotlin_version = '1.2.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Kotlin newest version:
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.google.gms:google-services:1.5.0-beta2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Bit annoying but studio acts like it some times. Below steps can fix the issue.
Go to
Settings -> Build, Execution, Development -> Gradle -> Use default gradle wrapper(recommended)
change this to Use local and back to Use default. Studio will ask about updating gradle after closing the settings windows.
내 안드로이드 스튜디오를 3.0.1에서 3.2.1로 업데이트 한 후에도 같은 문제에 직면했습니다.이 문제를 사용한 후에 내 문제가 해결되었습니다.
buildscript {
ext.kotlin_version = '1.2.51'
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Canary 채널의 최신 Android Studio 에서이 문제에 직면했습니다. Android Studio를 안정적인 버전으로 다운 그레이드하는 것도 고려할 수 있습니다.
Android Studio 3.0 RC1에서 발생했습니다.
참고 URL : https://stackoverflow.com/questions/43928118/outdated-kotlin-runtime-warning-in-android-studio
'IT' 카테고리의 다른 글
안드로이드 스튜디오, gradle 및 NDK (0) | 2020.06.10 |
---|---|
소수점 이하 2 자리 허용 (0) | 2020.06.10 |
Visual Studio 설치 문제- '설치 구성 요소를로드하는 동안 문제가 발생했습니다. (0) | 2020.06.10 |
Nginx 403 오류 : [폴더]의 디렉토리 색인이 금지되어 있습니다. (0) | 2020.06.10 |
JSON 파일에서 R로 데이터 가져 오기 (0) | 2020.06.10 |