Kotlin 오류 : org.jetbrains.kotlin : kotlin-stdlib-jre7 : 1.0.7을 찾을 수 없습니다.
Kotlin 플러그인을 내 앱 (v. v1.1.1-release-Studio2.2-1)에 설치 한 다음 "Configure Kotlin in Project"를 선택했습니다. 컴파일러 및 런타임 버전 1.0.7을 선택했습니다. Kotlin이 내 Gradle 파일을 업데이트했습니다. 이제 빌드하려고 할 때 다음을 얻습니다.
오류 : ': app'프로젝트를 구성하는 중에 문제가 발생했습니다. 구성 ': app : _debugApkCopy'에 대한 모든 종속성을 해결할 수 없습니다. org.jetbrains.kotlin : kotlin-stdlib-jre7 : 1.0.7을 찾을 수 없습니다. 필요한 사람 :
MyApplication : app : 지정되지 않음
내가 여기서 무엇을 놓치고 있는지 잘 모르겠습니다.
바꾸다
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
와
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
jre가 포함 된 버전이 절대적이므로 프로젝트를 교체하고 동기화하십시오.
공식 문서는 여기 에 링크를 주셔서 감사합니다 @ ROMANARMY
해피 코딩 :)
프로젝트 수준 build.gradle
에서이 버전 만 사용
ext.kotlin_version = '1.3.31'
다른 버전 제거
이것은 최신 버전의 android studio 3.4에서만 작동합니다.
업데이트 : 오류를 방지하려면 최신 Android 스튜디오에서 최신 버전의 kotlin을 사용하십시오.
의 분할 kotlin-stdlib
로 kotlin-stdlib-jre7
와는 kotlin-stdlib-jre8
단지 의존성이 해결 될 수없는 이유, 패키지 버전은 단순히 존재하지 않는 사용자들은, 코 틀린 1.1에서 도입되었습니다.
프로젝트 파일에 대한 업데이트가 어느 시점에서 실패하고 Kotlin 버전을 1.0.7로 설정 한 것 같습니다. 이것이 새로운 프로젝트이고 1.1.1을 사용하는 데 방해가되는 것이 없다면 그 프로젝트로 전환하겠습니다. 이렇게하면 문제가 사라질 것입니다.
"build.gradle"파일에서 해당 줄의 현재 Kotlin 버전을 변경하고 synk를 누릅니다.
ext.kotlin_version = '1.1.1'
/// 다음과 같이 표시됩니다.
// 모든 하위 프로젝트 / 모듈에 공통적 인 구성 옵션을 추가 할 수있는 최상위 빌드 파일입니다.
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
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 1.1.2부터 그룹과의 종속성 org.jetbrains.kotlin
은 기본적으로 적용된 플러그인에서 가져온 버전으로 해결됩니다. 다음과 같은 전체 종속성 표기법을 사용하여 수동으로 버전을 제공 할 수 있습니다.
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
JDK 7 또는 JDK 8을 대상으로하는 경우 새 JDK 버전에 추가 된 API에 대한 추가 확장 함수가 포함 된 확장 버전의 Kotlin 표준 라이브러리를 사용할 수 있습니다. kotlin-stdlib 대신 다음 종속성 중 하나를 사용하십시오.
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
buildscript {
**ext.kotlin_version = '1.1.1'** //Add this line
repositories {
**jcenter()** //Add this line
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
**jcenter()** //Add this line
google()`enter code here`enter code here`
maven { url "https://jitpack.io" }
}
}
Android Studio 3.2를 사용하는 경우 새로운 솔루션으로, 프로젝트의 build.gradle에 mavenCentral ()을 추가하여이 문제를 해결했습니다.
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
이 주문으로 라인을 추가해야합니다. 이 답변에 대한 크레딧이 있습니다.
이것이 나를 위해 일한 것입니다 : Gradle 4.8.1 사용
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'}
}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
}
I have solved this issue using deselection of the Offline work option in Settings
Please check current version of your Kotlin in below path,
C:\Program Files\Android\Android Studio\gradle\m2repository\org\jetbrains\kotlin\kotlin-stdlib\1.0.5
change to that version (1.0.5)
in project level gradle file.
You can see in your above path does not mentioned any Java - jre version
, so remove in your app level gradle file as below,
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
If you are using Android Studio 3.2 & above,then issue will be solved by adding google() & jcenter() to build.gradle of the project:
repositories {
google()
jcenter()
}
In case a (transitive) dependency still uses the jre
variant of the Kotlin library, you can force the use of the jdk
variant with the help of a resolution strategy:
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
details.requested.with {
if (group == "org.jetbrains.kotlin" && name.startsWith("kotlin-stdlib-jre")) {
details.useTarget(group: group, name: name.replace("jre", "jdk"), version: version)
details.because("Force use of 'kotlin-stdlib-jdk' in favor of deprecated 'kotlin-stdlib-jre'.")
}
}
}
}
}
Simple Steps:
Click File > Project Structure
Click Dependencies > Find and Click org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21 (or whatever your current version is)
Under Details > update section, click [update variable][update dependencies]
- Click Ok
Best Regards
'development' 카테고리의 다른 글
DBCP-다른 데이터베이스에 대한 validationQuery (0) | 2020.10.11 |
---|---|
mysql에서 이름 문자열을 분할하는 방법은 무엇입니까? (0) | 2020.10.11 |
R에서 사전 / 목록 작업 (0) | 2020.10.11 |
WebResponse.GetResponseStream 반환을 문자열로 변환하는 방법은 무엇입니까? (0) | 2020.10.11 |
파이썬 데코레이터에 추가 인수를 어떻게 전달합니까? (0) | 2020.10.11 |