Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle 3.0 废弃掉了compile、provider和Lint #2

Open
ouyangpeng opened this issue Nov 21, 2017 · 6 comments
Open

Gradle 3.0 废弃掉了compile、provider和Lint #2

ouyangpeng opened this issue Nov 21, 2017 · 6 comments

Comments

@ouyangpeng
Copy link

Gradle 3.0 废弃掉了compile 和 provider,所以得更新代码兼容才行

@ouyangpeng
Copy link
Author

ouyangpeng commented Nov 21, 2017

Gradle 3.0 关于获取Lint Task 也出问题了

//获取Lint Task
def variantName = variant.name.capitalize()
Lint lintTask = project.tasks.getByName("lint" + variantName) as Lint

image

Lint 直接报红色,提示已经没有这个对象。

@ouyangpeng ouyangpeng changed the title Gradle 3.0 废弃掉了compile 和 provider Gradle 3.0 废弃掉了compile、provider和Lint Nov 21, 2017
@biaomingzhong
Copy link

@ouyangpeng @GavinCT 那怎么处理这个问题

@LineChen
Copy link

@ouyangpeng
Copy link
Author

@LineChen 这个和 具体的lint插件不一样

@biaomingzhong
Copy link

biaomingzhong commented Jan 22, 2018

现在才看到,可以直接用新的 API,看看就知道怎么用了

import com.android.build.gradle.tasks.LintGlobalTask
import com.android.build.gradle.tasks.LintPerVariantTask

其中用法还是原来那样

variants.all { variant ->
            def variantName = variant.name.capitalize()

            LintPerVariantTask lintTask = project.tasks.getByName("lint" + variantName) as LintPerVariantTask
}

@LineChen
Copy link

@ouyangpeng @biaomingzhong 多谢,我去试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants