【发布时间】:2019-08-19 18:01:56
【问题描述】:
在同步当前项目时,我收到如下警告:“错误配置‘编译’已过时,已替换为‘实现和‘api’。如何修复此错误。
build.gradle(项目:xyz)
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "io.realm:realm-gradle-plugin:2.2.0"
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
bulid.gradle(module:app)
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app.wordpress"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-config:16.4.0'
implementation 'com.google.firebase:firebase-invites:16.1.1'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation('com.squareup.retrofit2:retrofit:2.0.0-beta4') {
exclude module: 'okhttp'
}
implementation 'com.squareup.okhttp3:okhttp:3.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.0.1'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.balysv:material-ripple:1.0.2'
}
我已尝试将“编译”更改为“实现”。
警告:配置“编译”已过时,已替换为“实施”和“API”。 它将在 2018 年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响的模块:app
【问题讨论】:
-
您在 2.2.0 版本中引入了 Realm 的 gradle 插件,它将 Realm 依赖项添加为
compile。您可能想要升级 Realm,或者按照文档中的说明手动添加依赖项。
标签: android android-gradle-plugin