在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:

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


当前回答

希望build.gradle(app)对你有影响 如果是这样,请执行此步骤

在build.gradle中将compile替换为androidtestimplemimplementation

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

如此简单!希望这能解决

其他回答

我尝试了这里提到的所有解决方案,但运气不佳。 我在我的身材里发现的。Gradle文件如下:

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }

我只是将其更改为如下所示并保存并尝试构建成功。

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
    }

回到你的位置。在项目级别的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
}

希望build.gradle(app)对你有影响 如果是这样,请执行此步骤

在build.gradle中将compile替换为androidtestimplemimplementation

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

如此简单!希望这能解决

我已经更新了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'

    }
}

对我来说,解决这个问题的变通方法是我使用了一个旧版本的Gradle,可以在这里找到:

我使用的是gradle-3.0-rc-1-src版本,但其他版本也可以,尽管它可能不会比3.0版本更新。

首先将压缩文件解压到您喜欢的任何地方。

然后进入文件->设置->构建,执行,部署-> Gradle,并将设置更改为使用本地Gradle分布。在此之后,确保Gradle home字段指向刚刚解压到的目录中的. Gradle目录。

重新构建项目,一切都应该正常。