WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

在设置百分布局的时候,我们在build里面修改了一行代码

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:percent:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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'
}

然后会提示

Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'and'api'.
It will be removed at the end of 2018

意思就是

compile会被在2018年底取消,会被imlementation替代,所以会报这个警告,解决警告的方式就是换成imlementation就好了。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:percent:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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'
}

这个提示是gradle文件自上次更新后又发生了变化,需要再次同步,这里直接点Sync Now就好了

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭