android - 建立警告?
问题描述
每当我构建我的 android 项目时,我都会收到以下警告。
Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'.
Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
我检查了我的 Gradle 文件并根据 Android Studio 的建议,将Compile指令替换为Implementation指令。
该应用程序现在运行良好,但我想处理这些警告。
编辑:我的 gradle 文件 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.shaitest.testcam"
minSdkVersion 23
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'
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
//compile 'com.google.firebase:firebase-invites:15.0.0'
implementation 'com.google.firebase:firebase-invites:11.8.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
testCompile 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
解决方案
警告的意思正是他们所说的。
这些指令现在已经过时(不再使用或过时)。取而代之的是,Android 有 Android Studio 建议您使用的新指令。
通过用新指令替换它们,您已经正确处理了警告。
推荐阅读
- sql - SQL Join 仅存在于右表中的值
- azure - 如何在 C# 测试中从 azure devops(前 vsts)的测试用例中获取参数值?
- javascript - 在 wp_footer() 之后调用 JS 脚本;
- javascript - 带有laravel mix和eslint的vuejs路由器中的意外令牌导入
- android - Android 在后台杀死我的应用程序
- c# - SwipeItem XAML 绑定被忽略
- python - 在 python/scapy 中采样流量
- javascript - 如何让按钮在某个时间点后更改其步骤而不会失去价值?
- python - DataFrame 中系列的平均值
- c# - 如何在 C# 中获取上述目录中的文件地址?