Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Android Gradle - Build Tips - Lint HTML Layout

DZone's Guide to

Android Gradle - Build Tips - Lint HTML Layout

Gradle 2.10 is out, and with it a bevy of features. One new inclusion is that of Lint checking HTML reports. Here s a quick overview of Lint HTML Gradle build tips.

· Mobile Zone ·
Free Resource

With the release of Gradle 2.10 there is a nice feature of Lint check HTML reports.

Simply speaking, whenever you run a build, a nice formatted HTML report will be generated. It is a VERY nice touch to the lint XML reports and makes the report much more readable and hence more actionable. It will save you time and make your code more robust and stable.

This feature was contributed by Sebastian Schuberth.

To check it out do the following:

  1. Download Gradle 2.10 and extract it to the default Android Studio Gradle directory.
    It may be:
    C:/Program Files/Android/Android Studio/gradle/gradle-2.10

  2. locate the file gradle-wrapper.properties via Android Studio and change distributionUrl to: https\://services.gradle.org/distributions/gradle-2.10-all.zip

  3. In Android Studio open File->Settings and change Gradle location to the one you extracted the Gradle 2.10 file.

  4. Open a terminal for the project folder (either by Android Studio terminal view or explicitly via command line tool) and type: gradlew {module.name}:build

    Note: The parameter {module.name} is optional and intended for multi-module project where you want to build certain modules.

That's it.

After the build finishes, scroll via its output and you will see something similar to:

Wrote HTML report to file:///C:/dev/workspace/common/commonlibrary/build/outputs/lint-results.html

Wrote XML report to file:///C:/dev/workspace/common/commonlibrary/build/outputs/lint-results.xml

Open the HTML link and you would be pleasantly surprised.

Check it out:

IMHO, the generated report is visually better than the report being generated via Android Studio ->Code Inspection. It is very convenient to read the warnings/errors and correct.

Another advantage is that report will be generated on every build and not on demand.

Note:

The lint HTML report would be generated from the command line and not via Android Studio default build.

This article was originally posted here.

Topics:
java ,android ,gradle ,mobile app

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}