Sau*_*rma 63 android android-studio android-gradle-plugin
在我成功更新到Android Studio 3.1 Canary 9之后,我收到了警告消息
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
Run Code Online (Sandbox Code Playgroud)
我知道这个警告不会在我的项目中造成任何问题,至少目前是这样.但我想完全删除它,以便将来不会有任何问题.但在查看我的build.gradle文件后,我找不到任何已调用此警告的代码行.
这是我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.project.virtualdiary"
minSdkVersion 21
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 'com.google.firebase:firebase-auth:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
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'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:support-vector-drawable:27.0.2'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
Nik*_*las 75
问题在于 apply plugin: 'com.google.gms.google-services'
Google服务插件代表您添加了依赖项.希望他们将来能够解决这个问题.
Did*_*ier 43
我对com.google.gms:google-services有同样的警告.
解决方案是将classpath com.google.gms:google-services升级到classpath"com.google.gms:google-services:3.2.0"在build.gradle项目中的文件中:
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
}
Run Code Online (Sandbox Code Playgroud)
在Android Studio版本3.1中,依赖项complie word被替换为实现
在android studio 3.1中使用Warning的依赖项
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'
}
Run Code Online (Sandbox Code Playgroud)
依赖关系在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'
}
Run Code Online (Sandbox Code Playgroud)
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
祝好运
我同意尼克拉斯的观点.我改变了compile
到implementation
,但警告是在变更后只进行了build.gradle(Project: .....)
之前:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.0.0'
}
Run Code Online (Sandbox Code Playgroud)
后:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
48004 次 |
最近记录: |