建立警告?

时间:2018-06-23 08:22:23

标签: android compilation

每当我构建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'

2 个答案:

答案 0 :(得分:1)

警告的含义与他们所说的完全一样。

指令现在已过时( 不再使用或已过时 )。代替它们,Android具有Android Studio建议您使用的新指令。

通过用新指令替换它们,您已正确处理了警告。

答案 1 :(得分:0)

问题本身有答案,您需要使用 androidTestImplementation 和上述其他警告更改 androidTestCompile

查看文档以获取更多详细信息https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration