Skip to content

Commit 375d72b

Browse files
committed
docs: Added docs for lint tool. Change-Id: I06192262b56e0333bcfbcac223395788f7b0d072
Bug: 5942358 Change-Id: Ib15f96f267aa0a713fbd03b3bf5dced8c37da12e
1 parent 707e632 commit 375d72b

File tree

6 files changed

+407
-59
lines changed

6 files changed

+407
-59
lines changed

docs/html/images/tools/lint.png

29.2 KB
Loading
71.6 KB
Loading

docs/html/tools/debugging/debugging-ui.jd

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ parent.link=index.html
2929
<li><a href="#overlays">Working with Pixel Perfect overlays</a></li>
3030
</ol>
3131
</li>
32-
<li><a href="#layoutopt">Using layoutopt</a></li>
32+
<li><a href="#lint">Using lint to optimize your UI</a></li>
3333
</ol>
3434
<h2>Related videos</h2>
3535
<ol>
@@ -55,15 +55,15 @@ parent.link=index.html
5555
<p>
5656
Sometimes your application's layout can slow down your application.
5757
To help debug issues in your layout, the Android SDK provides the Hierarchy Viewer and
58-
<code>layoutopt</code> tools.
58+
<code>lint</code> tools.
5959
</p>
6060

6161
<p>The Hierarchy Viewer application allows you to debug and optimize your user interface. It
6262
provides a visual representation of the layout's View hierarchy (the View Hierarchy window)
6363
and a magnified view of the display (the Pixel Perfect window).</p>
6464

65-
<p><code>layoutopt</code> is a command-line tool that helps you optimize the layouts and layout
66-
hierarchies of your applications. You can run it against your layout files or resource
65+
<p>Android <code>lint</code> is a static code scanning tool that helps you optimize the layouts and layout
66+
hierarchies of your applications, as well as detect other common coding problems. You can run it against your layout files or resource
6767
directories to quickly check for inefficiencies or other types of problems that could be
6868
affecting the performance of your application.</p>
6969

@@ -491,57 +491,7 @@ Sometimes your application's layout can slow down your application.
491491
alt=""
492492
height="600"/>
493493
<p class="img-caption"><strong>Figure 4.</strong> The Pixel Perfect window</p>
494-
<h2 id="layoutopt">Using layoutopt</h2>
495-
<p>
496-
The <code>layoutopt</code> tool lets you analyze the XML files that define your
497-
application's UI to find inefficiencies in the view hierarchy.</p>
498-
499-
<p>
500-
To run the tool, open a terminal and launch <code>layoutopt &lt;xmlfiles&gt;</code>
501-
from your SDK <code>tools/</code> directory. The &lt;xmlfiles&gt; argument is a space-
502-
delimited list of resources you want to analyze, either uncompiled resource xml files or
503-
directories of such files.
504-
</p>
505-
<p>
506-
The tool loads the specified XML files and analyzes their definitions and
507-
hierarchies according to a set of predefined rules. For every issue it detects, it
508-
displays the following information:
509-
</p>
510-
<ul>
511-
<li>
512-
The filename in which the issue was detected.
513-
</li>
514-
<li>
515-
The line number for the issue.
516-
</li>
517-
<li>
518-
A description of the issue, and for some types of issues it also suggests a resolution.
519-
</li>
520-
</ul>
521-
<p>The following is a sample of the output from the tool:</p>
522-
<pre>
523-
$ layoutopt samples/
524-
samples/compound.xml
525-
7:23 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
526-
11:21 This LinearLayout layout or its FrameLayout parent is useless
527-
samples/simple.xml
528-
7:7 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
529-
samples/too_deep.xml
530-
-1:-1 This layout has too many nested layouts: 13 levels, it should have &lt;= 10!
531-
20:81 This LinearLayout layout or its LinearLayout parent is useless
532-
24:79 This LinearLayout layout or its LinearLayout parent is useless
533-
28:77 This LinearLayout layout or its LinearLayout parent is useless
534-
32:75 This LinearLayout layout or its LinearLayout parent is useless
535-
36:73 This LinearLayout layout or its LinearLayout parent is useless
536-
40:71 This LinearLayout layout or its LinearLayout parent is useless
537-
44:69 This LinearLayout layout or its LinearLayout parent is useless
538-
48:67 This LinearLayout layout or its LinearLayout parent is useless
539-
52:65 This LinearLayout layout or its LinearLayout parent is useless
540-
56:63 This LinearLayout layout or its LinearLayout parent is useless
541-
samples/too_many.xml
542-
7:413 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
543-
-1:-1 This layout has too many views: 81 views, it should have &lt;= 80!
544-
samples/useless.xml
545-
7:19 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
546-
11:17 This LinearLayout layout or its FrameLayout parent is useless
547-
</pre>
494+
<h2 id="lint">Using lint to Optimize Your UI</h2>
495+
<p>The Android {@code lint} tool lets you analyze the XML files that define your application's UI to find inefficiencies in the view hierarchy.</p>
496+
<p class="note"><strong>Note: </strong>The Android <code>layoutopt</code> tool has been replaced by the {@code lint} tool beginning in ADT and SDK Tools revision 16. The {@code lint} tool reports UI layout performance issues in a similar way as <code>layoutopt</code>, and detects additional problems.</p>
497+
<p>For more information about using {@code lint}, see <a href="{@docRoot}tools/debugging/improving-w-lint.html">Improving Your Code with lint</a> and the <a href="{@docRoot}tools/help/lint.html">lint reference documentation</a>.</p>

0 commit comments

Comments
 (0)