android - 每次构建项目时都会出错
问题描述
每当我打开或重建我的项目时,都会出现警告,有时会出现错误:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018.
它在 build.gradle 中显示警告,其中包含以下代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.espoir.myappid"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
}
apply plugin: 'com.google.gms.google-services'
谁能帮我解决这个问题?谢谢
解决方案
将项目级build.gradle
库更新到最新版本。
更新
将你的两个类路径升级到最新版本
像这样:
YourProjectName/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
推荐阅读
- c - 为什么调用 pthread_yield 的父线程不让子线程先运行?
- reactjs - React.js - 无法读取未定义的属性,即使上下文已绑定(从子调用父方法)
- docker - 运行 Memcached docker 映像的问题
- c# - 如何注销或过期 ASP.NET Core Web API 的 JWT 令牌?
- jspdf - jsPDF - 适合宽度的购物车 HTML 页面的实际示例?
- javascript - 如何将表单与 onclick 按钮结合使用 javascript 执行功能?
- azure-devops - 多个代码覆盖率报告合并、发布,在 Azure DevOps 管道中没有显示数据
- asp.net - 在 asp.net Core 3.1 项目中 UseSQLServer() 连接是否可以被 ODBC 替换?
- laravel - Laravel 8 - 如何从 3 个表中建立关系
- bash - bash 扩展 glob 中的否定不起作用