建设机器人工作室项目时,运行皮棉 [英] Run lint when building android studio projects

查看:136
本文介绍了建设机器人工作室项目时,运行皮棉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够运行,当我建立了Android Studio项目,以确保得到遵守的规则皮棉皮棉任务。

我使用任务相关性,但没有运气都试过了。我的TeamCity构建服务器使用它运行皮棉任务生成任务,使伟大工程。然而,Android的工作室似乎使用generateDebugSources和compileDebugJava任务交替时,我选择了调试版本的变种。

下面是我曾在我的build.gradle:

  assemble.dependsOn皮棉
 

解决方案

如果你只是想配置你的Andr​​oid Studio项目,而不影响您的摇篮任务是如何配置运行默认的运行配置前皮棉检查,可以按照以下步骤。

  1. 打开运行配置下拉菜单,选择修改

<醇开始=2>
  • 选择您的应用程序的运行配置
  • <醇开始=3>
  • preSS的+添加一个新的台阶
  • <醇开始=4>
  • 选择摇篮感知使
  • 键入检查,并选择与您的应用程序模块名称和检查的选项。 (我的是:应用:检查
  • <醇开始=6>
  • preSS向上箭头将新的检查现有的摇篮感知化妆前一步一步
  • 现在,Android的工作室将运行绒毛检查和构建失败,如果发生任何皮棉错误。

    I would like to be able to run the lint task when I'm building projects with android studio to ensure the lint rules are being followed.

    I have tried using task dependencies but with no luck. My teamcity build server uses the build task which runs the lint task, so that works great. However, android studio appears to use generateDebugSources and compileDebugJava tasks interchangeably when I have selected the debug build variant.

    Here is what I have tried in my build.gradle:

    assemble.dependsOn lint
    

    解决方案

    If you just want to configure your Android Studio project to run the lint check before the default run configuration without affecting how your gradle tasks are configured, you can follow these steps.

    1. Open the run configurations drop down and choose edit

    1. Select your app run configuration

    1. Press the '+' to add a new step

    1. Choose "Gradle-aware Make"

    1. Type 'check' and choose the option with your app module name and check. (Mine is :app:check)

    1. Press the up arrow to move the new check step before the existing Gradle-aware make step

    Now, Android Studio will run the lint check and fail the build if any lint errors occur.

    这篇关于建设机器人工作室项目时,运行皮棉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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