Gradle-오류 인수에 대한 method implementation ()을 찾을 수 없음 [com.android.support:appcompat-v7:26.0.0]
Android 스튜디오에서 기존 Android 프로젝트를 열려고하는데 gradle이 오류없이 앱을 빌드 할 수 없습니다.
Android Studio가 계속 던지는 오류
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의 내 코드 내 종속성
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"
}
문제 해결을 도와주세요
교체 compile
와 함께 implementation
.
compile
최근에 더 이상 사용되지 않고 implementation
또는api
gradle 버전 3을 확인하십시오 .. "구현"을 사용하기 전에 이상.
종속성에서 프로젝트 수준 gradle 파일 열기
dependencies{
classpath 'com.android.tools.build:gradle:3.1.2'
}
gradle wrapper-properties를 열고 배포 URL을 다음과 같이 사용하십시오.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
또는 최신 버전
synk 프로젝트, 이것이 당신의 문제를 해결하기를 바랍니다
You need to use at least Gradle 3.4 or newer to be able to use implementation
. It is not recommended to keep using the deprecated compile
since this can result in slower build times. For more details see the official android developer guide:
When your module configures an implementation dependency, it's letting Gradle know that the module does not want to leak the dependency to other modules at compile time. That is, the dependency is available to other modules only at runtime. Using this dependency configuration instead of api or compile can result in significant build time improvements because it reduces the amount of projects that the build system needs to recompile. For example, if an implementation dependency changes its API, Gradle recompiles only that dependency and the modules that directly depend on it. Most app and test modules should use this configuration.
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations
Update: compile
will be removed by end of 2018, so make sure that you use only implementation
now:
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018
change apply plugin: 'java' to apply plugin: 'java-library'
So ridiculous, but I still wanna share my experience in case of that someone falls into the situation like me.
Please check if you changed: compileSdkVersion
--> implementationSdkVersion
by mistake
Your Code
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
Replace it By
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
As mentioned here, https://stackoverflow.com/a/50941562/2186220, use gradle plugin version 3 or higher while using 'implementation'.
Also, use the google()
repository in buildscript
.
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
These changes should solve the issue.
'Programing' 카테고리의 다른 글
ASP.NET Core MVC에서 URL 리퍼러를 얻으려면 어떻게하나요? (0) | 2020.11.11 |
---|---|
tmux에서 창 이름을 바꾸는 방법은 무엇입니까? (0) | 2020.11.11 |
C 콘솔에 바이너리 트리를 "그리는"방법 (0) | 2020.11.11 |
키워드가 지원되지 않는 데이터 소스 (0) | 2020.11.11 |
HashSet 사용 방법 (0) | 2020.11.11 |