Gradle - 오류 [com.android] 인수에 대한 메서드 구현()을 찾을 수 없습니다.지원: appcompat-v7:26.0.0]
안드로이드 스튜디오에서 기존 안드로이드 프로젝트를 열려고 하는데 오류가 없으면 gradle이 앱을 만들 수 없습니다.
에러 안드로이드 스튜디오가 계속 던진다.
Error:(74, 1) A problem occurred evaluating project ':app'.
> Could not find method implementation() for arguments
[com.android.support:appcompat-v7:26.0.0] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
build.gradle의 My Code는 문제를 이해하는 데 도움이 됩니다.내 의존관계
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// google & support
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
// utils
implementation 'com.github.bumptech.glide:glide:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
implementation 'com.koushikdutta.ion:ion:2.1.7'
implementation 'com.github.Commit451:bypasses:1.0.4'
implementation 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
implementation 'com.drewnoakes:metadata-extractor:2.9.1'
implementation "com.orhanobut:hawk:2.0.1"
}
문제 해결을 도와주세요.
에 해 주세요.android/app/build.gradle
아니라, 이에요.android/build.gradle
.
compile
implementation
.
compile
최근에 폐지되어 로 대체되었다.implementation
★★★★★★★★★★★★★★★★★」api
이 「 」인 것을 .3.*.*
그 이상일 경우, "communications"를 사용합니다.
종속성 아래에서 프로젝트 수준 Gradle 파일을 엽니다.
dependencies{
classpath 'com.android.tools.build:gradle:3.1.2'
}
gradle-wrapper.properties를 합니다.distributionUrl
:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
또는 최신 버전입니다.
프로젝트를 동기화합니다.이것으로 당신의 문제가 해결되길 바랍니다.
Gradle 3.4 이상을 사용해야 사용할 수 있습니다.implementation
된 .를 계속 되지 않습니다.compile
빌드 시간이 느려질 수 있습니다.상세한 것에 대하여는, Android의 공식 개발자 가이드를 참조해 주세요.
모듈이 구현 종속성을 설정하면 모듈이 컴파일 시 종속성을 다른 모듈로 누설하지 않도록 Gradle에게 알립니다.즉, 의존관계는 실행 시에만 다른 모듈에서 사용할 수 있습니다.api 또는 컴파일 대신 이 종속성 구성을 사용하면 빌드 시스템이 다시 컴파일해야 하는 프로젝트의 양이 줄어들기 때문에 빌드 시간이 크게 단축될 수 있습니다.예를 들어 구현 종속성이 API를 변경하면 Gradle은 해당 종속성 및 직접 종속된 모듈만 다시 컴파일합니다.대부분의 앱 및 테스트 모듈에서 이 구성을 사용해야 합니다.
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations
compile
이니 2018년만 하세요.implementation
now now now now:
경고:구성 '컴파일'은 사용되지 않으며 '실장'으로 대체되었습니다.2018년 말에 철거될 예정입니다.
apply plugin: 'sublic'을 변경하여 플러그인 적용: 'sublic-sublic'
나는 내 의존관계를 잘못된 위치에 두었다.
buildscript {
dependencies {
//Don't put dependencies here.
}
}
dependencies {
//Put them here
}
앱 폴더에 종속성을 추가하여 해결했습니다.
app < Gradle Scripts > gradle로 이동합니다.build(Module: app) 및 depandancies를 글로벌 build.gradle 파일이 아닌 해당 파일에 추가합니다.
말도 안 돼, 하지만 누군가 나 같은 상황에 빠질 경우를 대비해서 내 경험을 공유하고 싶어.
변경되었는지 확인하십시오.compileSdkVersion
-->implementationSdkVersion
잘못해서
이사했다implementation
루트 레벨의 build.gradle에서 모듈 레벨의 build.gradle로 이동합니다.그게 문제를 해결해요.
고객님의 코드
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
치환자
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
의 치환implementation
와 함께classpath
.그러면 되겠군요.
https://stackoverflow.com/a/50941562/2186220,은 여기서 설명한 바와 같이 gradle 플러그인 버전 3 이상을 사용하고 있으며, 'communications'를 사용하고 있습니다.
또,google()
저장소buildscript
.
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
이러한 변경으로 문제가 해결될 것입니다.
공식 문서에서 권장하는 바와 같이 다음을 추가해야 합니다.
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
}
}
이것들을 추가하면, 에러가 없어집니다.또한 컴파일 대신 구현을 사용합니다.
저 같은 경우에는요.Implementation
대신implementation
.
구현이 정의되지 않은 경우 잘못된 파일에 쓰는 것입니다.Unity 2019+의 올바른 파일은 다음과 같습니다.main template grandle
다른 건 안 되고요
제게 문제는 다음과 같은 글을 쓴다는 것이었습니다.
android {
compileSdk 31
…
대신:
android {
compileSdkVersion 31
그러니까 꼭...build.gradle
정답입니다.
언급URL : https://stackoverflow.com/questions/45615474/gradle-error-could-not-find-method-implementation-for-arguments-com-android
'programing' 카테고리의 다른 글
Vue에서 상위 템플릿 구성 요소를 가져오는 방법 (0) | 2022.11.01 |
---|---|
(libnet ..etc )와 같은 서드파티 라이브러리를 사용하지 않고 C?를 사용하여 스위치를 플래딩(레이어 2)하도록 자체 MAC 플래더를 만드는 방법 (0) | 2022.11.01 |
WAMP WORDPRESS가 MySQL에 연결되지만 Maria에는 연결되지 않음DB (0) | 2022.11.01 |
플라스크 앱을 여러 개의 py 파일로 분할하는 방법은 무엇입니까? (0) | 2022.11.01 |
MARIADB - QUERY 패킷 전송 중 오류 발생(max_allowed_packet 아님) (0) | 2022.11.01 |