如何添加-Xlint:未选中我的Andr​​oid的摇篮基础的项目? [英] How to add -Xlint:unchecked to my Android Gradle based project?

查看:147
本文介绍了如何添加-Xlint:未选中我的Andr​​oid的摇篮基础的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着以下添加到根 build.gradle 文件:

I tried to add the following to the root build.gradle file:

subprojects {
    gradle.projectsEvaluated {
        tasks.withType(Compile) {
            options.compilerArgs << "-Xlint:unchecked -Xlint:deprecation"
        }
    }
}

不过,我得到这个:

But I'm getting this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Libraries:ActionBarSherlock:compileRelease'.
> invalid flag: -Xlint:unchecked -Xlint:deprecation

我是什么做错了吗?

What am I doing wrong?

推荐答案

这是为我工作:

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

这篇关于如何添加-Xlint:未选中我的Andr​​oid的摇篮基础的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆