경고가 계속 표시됨 : 'compile'구성이 더 이상 사용되지 않으며 'implementation'으로 대체되었습니다.


332

나는 모든 발생을 교체 한 compile으로 implementation내 프로젝트의에서 build.gradle,하지만, 난 여전히이 경고를 받고 있어요 :

여기에 이미지 설명을 입력하십시오

전체 프로젝트에서 "컴파일"을 찾으려고했지만 일치하는 것이 없습니다. 그래서 원인이 무엇입니까?


여전히 'compile'을 사용하는 로컬 라이브러리를 사용하고 있습니까?
— Devsil

@Devsil 아마도 ...하지만 어떻게 찾을 수 있습니까? 전체 프로젝트에서 Find in Path를 시도했지만 compile..를 찾을 수 없었습니다 .
— Rob

2
로컬 라이브러리를 사용하는 경우 gradle.build 파일이 Android Studio 창의 오른쪽에있는 프로젝트 뷰어에 있습니다. 해당 build.gradle 파일에는 구현과 달리 "컴파일"이 포함될 수 있습니다. build.gradle 파일이 없으면 해당 파일이 포함되어 있지 않은 것입니다. 로컬이 아닌 사용중인 라이브러리 일 수 있으므로 라이브러리를 변경할 수 없습니다. 따라서이 경고는 지금은 무시해도됩니다.
— Devsil

1
Gradle은 문제가 발생한 행 번호를 제공해야합니다
— Yetti99

그것을보십시오 : stackoverflow.com/questions/48623244/… 그리고 Failed to resolve: android.arch.persistence.room:runtime:1.1.1 Open File Show in Project Structure dialog버전을 변경하려고 시도1.0.0
— Saeid

답변:


496

나는 업데이트되었습니다 com.google.gms:google-services에서 3.1.1로 3.2.0와 경고가 나타나는 중단했다.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        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

    classpath 'com.google.gms:google-services:3.2.0'
    }
}

1
구성 '컴파일'은 더 이상 사용되지 않으며 '구현'으로 대체되었습니다. 모든 구글 서비스 종속성 {클래스 경로 'com.android.tools.build:gradle:3.1.0'}를 사용하여 명확하지 오전이 될 2018 년의 끝에서 제거됩니다
— Amit_android

"com.google.gms : google-services : 3.2.0을 찾을 수 없습니다."라는 메시지가 나타납니다. 내가 이것을 시도 할 때. 업데이트 : 3.1.1로 다시 변경했을 때 수동으로 보풀 경고를 트리거 한 다음 Alt + Enter를 눌러 수정 사항을 자동으로 적용하여 동기화 오류없이 com.google.gms : google-services : 3.2.0으로 변경했습니다. 차이점이 무엇인지 확실하지 않지만 실망 스럽습니다.
— jwehrle

좋아, 나는 그 차이를 이해한다고 믿는다. 프로젝트 및 모듈 build.gradle gms 클래스 경로를 버전 3.2.0으로 변경했습니다. 문제를 일으킨 것은 모듈 변경입니다. Project build.gradle gms 클래스 경로 버전 만 변경하십시오.
— jwehrle

jcenter () repo도 누락되었습니다! 프로젝트는 매우 오래되었고 그 저장소를 포함하지 않았습니다!
— Yani2000

그 줄을 파일에 수동으로 추가해야한다는 것을 의미합니까?
— hellogoodnight

125

com.google.gms : google-services에 대해 동일한 경고가 발생했습니다.

해결 방법은 build.gradle 프로젝트의 파일에서 클래스 경로 com.google.gms : google-services를 클래스 경로 'com.google.gms : google-services : 3.2.0'으로 업그레이드하는 것입니다.

여기에 이미지 설명을 입력하십시오

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        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
        classpath 'com.google.gms:google-services:3.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Android Studio verion 3.1에서 종속성을 보완하는 단어가 구현으로 대체되었습니다.

android studio 3.1에서 경고와의 종속성

dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile 'com.android.support:appcompat-v7:27.1.0'
            compile 'com.android.support.constraint:constraint-layout:1.0.2'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.1'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }

안드로이드 스튜디오 3.1에서 의존성 OK

    dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.android.support:appcompat-v7:27.1.0'
            implementation 'com.android.support.constraint:constraint-layout:1.0.2'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.1'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    }

Gradel은 새 프로젝트를 위해 Android Studio 3.1에서 생성합니다.

Gradel은 새 프로젝트를 위해 Android Studio 3.1에서 생성합니다.

https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html을 방문 하십시오.

자세한 내용은 https://docs.gradle.org/current/userguide/declaring_dependencies.html


"testCompile"이 "testImplementation"으로 변경됩니다.
— AJW

- 서비스를 구글하지만 모두 Gradle을 파일에 이전 명명 스타일을 업데이트하는 방법에 대한 전부 : 답변하고,뿐만 아니라 가장 인기있는 한, 대부분의 모든 com.google.gms에 초점을 맞추고있다
— kommradHomer

32

com.google.gms : google-services를 3.2.0에서 3.2.1로 업데이트했으며 경고 표시가 중지되었습니다.

 buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath 'com.google.gms:google-services:3.2.1'

    }
}

이 'com.google.gms : google-services : 3.2.0'이있는 것처럼 버전을 변경해야합니다 .3.2.0을 3.2.1로 바꾸면됩니다.
— Prateek218

감사합니다. 잘못된 클래스를 업데이트했기 때문에 오류가 발생했습니다.
— Jhorra

2
classpath 'com.google.gms:google-services:4.1.0'가장 업데이트되지 않은 버전이 있지만 그래,보다 큽니다 3.2.0. 여전히 해결책이 없습니다!
— sud007

@ sud007 당신이 직면하고있는 문제를 설명하거나 build.gradle (프로젝트 레벨)을 게시 할 수 있습니다
— Prateek218

22

현재 최신 버전의 Google gms 서비스를 사용하면 문제가 해결되었습니다.

프로젝트 레벨 build.gradle에서 :

buildscript {
    ...
    dependencies {
        classpath 'com.google.gms:google-services:3.2.1'
        ...  
    }
}

18

여기에있는 build.gradle 파일을여십시오.

여기에 이미지 설명을 입력하십시오

이것은 의존성 라이브러리를 작성하는 오래된 방법입니다 (gradle 버전 2 이하의 경우).

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile files('libs/volley.jar')
    compile 'com.android.support:support-v4:21.+'
}

이것은 gradle 버전 3의 종속성을 가져 오는 새로운 (올바른) 방법입니다.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation files('libs/volley.jar')
    implementation 'com.android.support:support-v4:21.+'
}

1
덕분에 친구! 이것은 2019 년 1 월 현재 가장 최신 답변 인 것 같습니다
— NaturalBornCamper

이 답변은이 문제에 처음으로 직면 한 사람들에게 도움이됩니다. OP에는 다른 질문이 있지만 변경 후에도 오류 메시지가 표시됩니다.
— sud007

13

Google 답글 : https://issuetracker.google.com/issues/74048134

여전히 컴파일을 사용하는 종속성이있을 수 있으므로 응용 프로그램 종속성과 전이 종속성을주의 깊게 확인하십시오.


1
내 프로젝트에 대한 모든의 build.gradles의 모든 종속성을 제거하고 여전히 오류가 얻을
— behelit

3
편집 : 그것은 이전 버전을 사용하여 영역에 의해 발생했습니다
— behelit

7

https://issuetracker.google.com/issues/72479188 은 플러그인이 때때로 "컴파일"종속성을 도입 할 수 있으며 이것이 경고를 유발한다는 것을 나타냅니다. 아마도 해당 문제를 별표로 표시하고 문제가 발생하는 플러그인을 지적 할 때까지 기다릴 수 있습니다.


6

라인을 제거 할 필요가 없습니다. Jkrevis가 작성한 것처럼 com.google.gms : google-services를 3.2.0으로 업데이트하면 경고가 중지됩니다.


1
프로젝트의 build.gradle (Module : App)에서 'compile'을 모두 'implementation'으로 바꾸고 build.gradle (Project)의 com.google.gms : google-services를 3.2.0으로 업데이트 했습니까?
— Tom

6

을 사용하지 않고이 문제가 발생합니다 com.google.gms:google-services. 이러한 종류의 문제를 해결하는 솔루션은 다음과 같습니다.

  1. build.gradle모든 프로젝트 및 모듈의 파일을 확인 하십시오. 또는이 경고의 원인을 찾기 위해 글로벌 검색 키워드 'compile'만 사용하십시오.
  2. 위의 방법으로이 경고를 해결할 수없는 경우 CLI 명령을 사용 하여 정보가 너무 많으므로 ./gradlew assembleDebug -d > gradle.log
    세부 디버그 정보를 이름이 지정된 파일 gradle.log또는 다른 파일에 인쇄하십시오 . 그런 다음 단어 "경고"를 검색하여에서 위치를 찾으십시오 gradle.log. 일반적으로 경고의 원인이되는 종속성 또는 플러그인을 찾을 수 있습니다.

2
이것이 일반적인 해결책이라고 생각합니다. 이 문제는 하나 또는 여러 개의 종속성으로 인해 발생할 수 있습니다.
— Rasmusob

5

내 경우에는 Realm 라이브러리에 의해 발생합니다. Realm의 최신 버전 (5.1.0까지)으로 업데이트 한 후에 문제가 해결되었습니다!

작동하는 gradle 스크립트는 다음과 같습니다.

buildscript {
repositories {
    jcenter()
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath "io.realm:realm-gradle-plugin:5.1.0"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.2.1'
  }
}

3

Google 서비스 버전을 업데이트해도 효과가 없었습니다.

  • 먼저 모든 종속성 compile이로 바뀝니다 implementation.
  • 프로젝트의 모든 종속성을 업데이트하십시오. 의존성 중 하나가 있으면 compile프로젝트 에이 오류가 표시 되기 때문 입니다. 따라서 모든 종속성 버전을 업데이트하십시오.

2

프로젝트 레벨에서 build.gradle 파일로 이동하면 다음 줄이 강조 표시됩니다.

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'  //place your cursor over here 
    //and hit alt+enter and it will show you the appropriate version to select


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

    classpath 'com.google.gms:google-services:4.0.2' //the same as previously
}

2

필자의 경우 전이 종속성에 대해 컴파일을 사용하는 것은 오래된 종속성이었습니다. com.jakewharton.hugo

내 gradle에서 제거 한 후 컴파일되었습니다.


1

이 문제를 해결하는 해결 방법은 이전 버전의 Gradle을 사용하는 것이 었 습니다 .

gradle-3.0-rc-1-src 버전을 사용했지만 3.0 버전보다 최신 버전이 아닌 다른 버전도 작동 할 수 있습니다.

먼저 zip 파일을 원하는 곳으로 추출하십시오.

그런 다음 File-> Settings-> Build, Execution, Deployment-> Gradle로 이동하여 로컬 gradle 배포 사용으로 설정을 변경하십시오. 그런 다음 Gradle Home 필드가 방금 압축을 푼 디렉토리의 .gradle 디렉토리를 가리키고 있는지 확인하십시오.

프로젝트를 다시 빌드하면 모든 것이 정상입니다.


0

Android Studio 3.0.1에서 Google gms 서비스 를 최신 com.google.gms:google-services:3.2.1으로 변경하려고 했지만 경고가 계속 발생합니다.

컴파일러에 의해 추천, 나는 모든 변경 compile에 의존 implementation하고 testCompile에 testImplementation이 같은 ..

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-ads:12.0.1'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.firebase:firebase-perf:12.0.1'
implementation 'com.google.firebase:firebase-appindexing:12.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

그리고 마지막으로 경고가 제거됩니다!


0

이 두 가지 옵션을 수행 할 수 있습니다.

  1. ur 프로젝트에서 클래스 경로 'com.google.gms : google-services : 3.2.0'추가 : build.gradle dependencies 및
  2. 모듈을 대체하십시오 : build.gradle을 구현과 호환하면 경고 메시지가 표시되지 않습니다.

0

단지에서 추가 build.gradle에서build script

classpath 'com.google.gms:google-services:3.2.0'

모든 종속성이로 "compile"바뀝니다 "implementation".

그것은 저에게서 일했습니다.


사용하는 경우 블록 classpath안에서 사용해야합니다 buildscript. 또한 블록 implementation안에서는 사용할 수 없습니다 buildscript.
— ChumiestBucket

0

현재 버전은 4.2.0입니다 .

빌드 스크립트 {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.2.0'
}

}


0

컴파일 을 구현으로 변경 수정했습니다.

전에

compile 'androidx.recyclerview:recyclerview:1.0.0'
compile 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'

후

implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'

-2

build.gradle (app)에 영향을 받기를 바랍니다. 그렇다면 다음 단계를 따르십시오.

교체 컴파일 과 androidTestImplementation build.gradle에

androidTestImplementation 'com.android.support:appcompat-v7:27.1.1'
androidTestImplementation 'com.android.support:design:27.1.1'

너무 간단합니다! 이것이 해결되기를 바랍니다


-3

필자의 경우 문제는 gradle 파일에 다음 줄이있는 Google 서비스 gradle 플러그인이었습니다.

플러그인 적용 : 'com.google.gms.google-services'

이것을 제거하면 문제가 해결되었습니다.


-7

build.gradle 로 이동 하십시오 (앱 레벨)

build.gradle 모듈 앱

"컴파일" 이라는 단어 를 "구현"으로 대체

100 % 작동합니다


6
이 답변은 유용하지 않습니다. OP는 이미 이것이 완료되었다고 말했기 때문에 도움이 될 수 없습니다.
— NightOwl888

1
나는 같은 문제가 있었다, 나는 내 응용 프로그램 apk bcoz를 생성 할 수 없습니다, 그 대답은 내 문제를 해결
— Ayoub

이것은 같은 상황이 아닙니다. OP는 이미이 작업을 수행했다고 언급했습니다 (동일한 보트에 있음). 이는 의존성 때문입니다
— ElliotM

OP는 "모든 컴파일을 구현으로 대체했다"고 말했다.
— mapo
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.