해당 이름의 작업이 이미 존재하므로 작업 '래퍼'를 추가 할 수 없습니다.
'react-native init AwesomeProject'를 설치할 때 'react-native run-android'를 실행할 때 위의 오류가 발생합니다.
Could not determine java version from '11.0.1'.
빠른 Google은 Gradle-wrapper에서 distributionUrl을 업데이트해야한다고 제안합니다. 이 작업을 수행하면 새로운 오류가 발생합니다.
Cannot add task 'wrapper' as a task with that name already exists.
문제가 파일에 있음을 나타냅니다.
/AwesomeProject/android/build.gradle' line: 36
이렇게 생겼어
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
나는 이것이 무엇을하는지 알아 내기 위해 앞뒤로 노력 해왔다. 상자에서 바로 작동하지 않는 것이 이상해 보입니다. 비슷한 문제에 직면 한 사람이 있습니까?
업데이트 할 수도 있습니다.
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
...에
wrapper {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
같이
4.8에서 더 이상 사용되지 않는 기본 제공 작업을 재정의하면 이제 오류가 발생합니다.
기본 제공 작업을 바꾸려고하면 다음과 유사한 오류가 발생합니다.
해당 이름의 작업이 이미 존재하므로 작업 'wrapper'를 추가 할 수 없습니다.
작업 및 속성 의 마지막 단락 참조 : https://docs.gradle.org/5.2.1/userguide/upgrading_version_4.html
그리고 래퍼 작업을 사용자 정의 : https://docs.gradle.org/5.2.1/userguide/gradle_wrapper.html#customizing_wrapper
환경에서 사용하는 Gradle 버전은 무엇입니까?
Gradle 버전 5.x를 사용하는 경우 아래와 같이 「작업 래퍼」를 수정해야합니다.
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
wrapper {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
댓글에서 언급했듯이 https://stackoverflow.com/a/46867575/4982729 :
파일을 열고 편집하십시오
app-folder/android/gradle/wrapper/gradle-wrapper.properties
. 라인 업데이트distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
파일에서
AwesomeProject/android/build.gradle
주석 처리를 시도하십시오.task wrapper(type: Wrapper) { gradleVersion = '4.4' distributionUrl = distributionUrl.replace("bin", "all") }
"gradle-wrapper.properties"파일에 이미 이러한 코드가있는 경우
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
그런 다음 제거 할 수 있습니다.
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
build.gradle에서
There's a high chance you have a "task" to run in your build.gradle file, go and remove the line related to wrapper (including its bracket and so on). Then, if you are using IntelliJ, it will automatically bring the new one to your working directory.
I have the same issue. the problem in my code was a double declaration on another Gradle file in build.gradle
build.gradle
apply from: otherFile.gradle
... build. gradle code...
apply from: otherFile.gradle //Again
'programing' 카테고리의 다른 글
UITextField 예측 텍스트 비활성화 (0) | 2020.11.03 |
---|---|
angular2의 구성 요소에 문자열 값을 전달하는 방법 (0) | 2020.11.03 |
ASP.NET Web API : 설명이없는 500 내부 서버 오류 (0) | 2020.11.02 |
깨끗한 프로젝트와 Android Studio에서 프로젝트 다시 빌드의 차이점 (0) | 2020.11.02 |
Entity Framework를 사용한 단위 테스트 (0) | 2020.11.02 |