当前位置: 首页 > 知识库问答 >
问题:

仍然收到警告:配置“compile”已过时,已替换为“implementation”

戎志勇
2023-03-14

在我的项目的构建中,我用实现替换了所有出现的编译。gradle,但我仍然收到以下警告:

我试图在整个项目中查找“compile”,但没有找到匹配项。那么原因是什么呢?

共有3个答案

松高爽
2023-03-14

我已经更新了com.google.gms:google-service从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'

    }
}
孔志强
2023-03-14

我有一个相同的警告引起com.google.谷歌服务。

解决方案是升级classpath com.google.gms:google为classpath'com提供服务。谷歌。gms:googleservices: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依赖项中,complie word被替换为实现

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'
    }

android studio 3.1中的依赖项正常

    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'

    }

Android Studio 3.1为新项目生成Gradel。

参观https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html

详情https://docs.gradle.org/current/userguide/declaring_dependencies.html

艾晋
2023-03-14

我已经更新了com.google.gms:googleservices3.1.13.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'
    }
}
 类似资料: