For First To Get Advantage for Run Android lint for your Android Project You May Need To Download
Eclipse With Latest Update as Well Android ADT Plugins 16 For use of Lint in Eclipse with out Command Line .
First if you are Using Old Eclipse Like Eclipse Galileo (3.5) and Eclipse Helios (3.6) Then i Prefer You to Use Latest Eclipse Which you can Download From www.Eclipse.org Click Here is Link http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigosr1
After Getting Eclipse Version 3.7 you can Setup Android Application Development Environment By Getting Guide From Below Link:
http://developer.android.com/sdk/installing.html
Check Requirement From Below Link :
http://developer.android.com/sdk/requirements.html
ok now when you Done Will Eclipse Indigo and Set up ADT 16 Plugin and Your Android SDK with it You can see One new Tool in Eclipse that it Run Android lint .Now Let see What is Run Android Lint.
Eclipse With Latest Update as Well Android ADT Plugins 16 For use of Lint in Eclipse with out Command Line .
First if you are Using Old Eclipse Like Eclipse Galileo (3.5) and Eclipse Helios (3.6) Then i Prefer You to Use Latest Eclipse Which you can Download From www.Eclipse.org Click Here is Link http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigosr1
After Getting Eclipse Version 3.7 you can Setup Android Application Development Environment By Getting Guide From Below Link:
http://developer.android.com/sdk/installing.html
Check Requirement From Below Link :
http://developer.android.com/sdk/requirements.html
ok now when you Done Will Eclipse Indigo and Set up ADT 16 Plugin and Your Android SDK with it You can see One new Tool in Eclipse that it Run Android lint .Now Let see What is Run Android Lint.
Android Lint is a new tool for ADT 16 (and Tools 16) which scans Android project sources for potential bugs. It is available both as a command line tool, as well as integrated with Eclipse. The architecture is deliberately IDE independent so it will hopefully be integrated with other IDEs, with other build tools and with continuous integration systems as well.
Here are some examples of the types of errors that it looks for:
- Missing translations (and unused translations)
- Layout performance problems (all the issues the old
layoutopt
tool used to find, and more) - Unused resources
- Inconsistent array sizes (when arrays are defined in multiple configurations)
- Accessibility and internationalization problems (hardcoded strings, missing contentDescription, etc)
- Icon problems (like missing densities, duplicate icons, wrong sizes, etc)
- Usability problems (like not specifying an input type on a text field)
- Manifest errors
and many more.
Now Here Are Some Advantages You Will Get to Known When You Run Android Lint for You Android Project .Here are lint Checks .
$ lint --show
Available issues:
Correctness
===========
AdapterViewChildren
-------------------
Summary: Checks that AdapterViews do not define their children in XML
Priority: 10 / 10
Severity: Warning
Category: Correctness
AdapterViews such as ListViews must be configured with data from Java code,
such as a ListAdapter.
More information:
http://developer.android.com/reference/android/widget/AdapterView.htmlMissingPrefix
-------------
Summary: Detect XML attributes not using the Android namespace
Priority: 8 / 10
Severity: Warning
Category: Correctness
Most Android views have attributes in the Android namespace. When referencing
these attributes you *must* include the namespace prefix, or your attribute
will be interpreted by aapt as just a custom attribute.
MissingTranslation
------------------
Summary: Checks for incomplete translations where not all strings are
translated
Priority: 8 / 10
Severity: Error
Category: Correctness
If an application has more than one locale, then all the strings declared in
one language should also be translated in all other languages.
By default this detector allows regions of a language to just provide a subset
of the strings and fall back to the standard language strings. You can require
all regions to provide a full translation by setting the environment variable
ANDROID_LINT_COMPLETE_REGIONS.
Proguard
--------
Summary: Looks for problems in proguard.cfg files
Priority: 8 / 10
Severity: Error
Category: Correctness
Using -keepclasseswithmembernames in a proguard.cfg file is not correct; it
can cause some symbols to be renamed which should not be.
Earlier versions of ADT used to create proguard.cfg files with the wrong
format. Instead of -keepclasseswithmembernames use -keepclasseswithmembers,
since the old flags also implies "allow shrinking" which means symbols only
referred to from XML and not Java (such as possibly CustomViews) can get
deleted.
More information:
http://code.google.com/p/android/issues/detail?id=16384ScrollViewCount
---------------
Summary: Checks that ScrollViews have exactly one child widget
Priority: 8 / 10
Severity: Warning
Category: Correctness
ScrollViews can only have one child widget. If you want more children, wrap
them in a container layout.
DuplicateIds
------------
Summary: Checks for duplicate ids within a single layout
Priority: 7 / 10
Severity: Warning
Category: Correctness
Within a layout, id's should be unique since otherwise findViewById() can
return an unexpected view.
InconsistentArrays
------------------
Summary: Checks for inconsistencies in the number of elements in arrays
Priority: 7 / 10
Severity: Warning
Category: Correctness
When an array is translated in a different locale, it should normally have the
same number of elements as the original array. When adding or removing
elements to an array, it is easy to forget to update all the locales, and this
lint warning finds inconsistencies like these.
Note however that there may be cases where you really want to declare a
different number of array items in each configuration (for example where the
array represents available options, and those options differ for different
layout orientations and so on), so use your own judgement to decide if this is
really an error.
You can suppress this error type if it finds false errors in your project.
NestedScrolling
---------------
Summary: Checks whether a scrolling widget has any nested scrolling widgets
within
Priority: 7 / 10
Severity: Warning
Category: Correctness
A scrolling widget such as a ScrollView should not contain any nested
scrolling widgets since this has various usability issues
ScrollViewSize
--------------
Summary: Checks that ScrollViews use wrap_content in scrolling dimension
Priority: 7 / 10
Severity: Warning
Category: Correctness
ScrollView children must set their layout_width or layout_height attributes to
wrap_content rather than fill_parent or match_parent in the scrolling
dimension
DuplicateIncludedIds
--------------------
Summary: Checks for duplicate ids across layouts that are combined with
include tags
Priority: 6 / 10
Severity: Warning
Category: Correctness
It's okay for two independent layouts to use the same ids. However, if layouts
are combined with include tags, then the id's need to be unique within any
chain of included layouts, or Activity#findViewById() can return an unexpected
view.
ExtraTranslation
----------------
Summary: Checks for translations that appear to be unused (no default language
string)
Priority: 6 / 10
Severity: Warning
Category: Correctness
If a string appears in a specific language translation file, but there is no
corresponding string in the default locale, then this string is probably
unused. (It's technically possible that your application is only intended to
run in a specific locale, but it's still a good idea to provide a fallback.)
ManifestOrder
-------------
Summary: Checks for manifest problems like <uses-sdk> after the <application>
tag
Priority: 5 / 10
Severity: Warning
Category: Correctness
The <application> tag should appear after the elements which declare which
version you need, which features you need, which libraries you need, and so
on. In the past there have been subtle bugs (such as themes not getting
applied correctly) when the <application> tag appears before some of these
other elements, so it's best to order your manifest in the logical dependency
order.
StateListReachable
------------------
Summary: Looks for unreachable states in a <selector>
Priority: 5 / 10
Severity: Warning
Category: Correctness
In a selector, only the last child in the state list should omit a state
qualifier. If not, all subsequent items in the list will be ignored since the
given item will match all.
GridLayout
----------
Summary: Checks for potential GridLayout errors like declaring rows and
columns outside the declared grid dimensions
Priority: 4 / 10
Severity: Error
Category: Correctness
Declaring a layout_row or layout_column that falls outside the declared size
of a GridLayout's rowCount or columnCount is usually an unintentional error.
PxUsage
-------
Summary: Looks for use of the "px" dimension
Priority: 2 / 10
Severity: Warning
Category: Correctness
For performance reasons and to keep the code simpler, the Android system uses
pixels as the standard unit for expressing dimension or coordinate values.
That means that the dimensions of a view are always expressed in the code
using pixels, but always based on the current screen density. For instance, if
myView.getWidth() returns 10, the view is 10 pixels wide on the current
screen, but on a device with a higher density screen, the value returned might
be 15. If you use pixel values in your application code to work with bitmaps
that are not pre-scaled for the current screen density, you might need to
scale the pixel values that you use in your code to match the un-scaled bitmap
source.
More information:
http://developer.android.com/guide/practices/screens_support.html#screen-independenceSecurity
========
ExportedService
---------------
Summary: Checks for exported services that do not require permissions
Priority: 5 / 10
Severity: Warning
Category: Security
Exported services (services which either set exported=true or contain an
intent-filter and do not specify exported=false) should define a permission
that an entity must have in order to launch the service or bind to it. Without
this, any application can use this service.
Performance
===========
UseCompoundDrawables
--------------------
Summary: Checks whether the current node can be replaced by a TextView using
compound drawables.
Priority: 6 / 10
Severity: Warning
Category: Performance
A LinearLayout which contains an ImageView and a TextView can be more
efficiently handled as a compound drawable
MergeRootFrame
--------------
Summary: Checks whether a root <FrameLayout> can be replaced with a <merge>
tag
Priority: 4 / 10
Severity: Warning
Category: Performance
If a <FrameLayout> is the root of a layout and does not provide background or
padding etc, it can be replaced with a <merge> tag which is slightly more
efficient.
InefficientWeight
-----------------
Summary: Looks for inefficient weight declarations in LinearLayouts
Priority: 3 / 10
Severity: Warning
Category: Performance
When only a single widget in a LinearLayout defines a weight, it is more
efficient to assign a width/height of 0dp to it since it will absorb all the
remaining space anyway. With a declared width/height of 0dp it does not have
to measure its own size first.
UnusedResources
---------------
Summary: Looks for unused resources
Priority: 3 / 10
Severity: Warning
Category: Performance
Unused resources make applications larger and slow down builds.
LIMITATIONS:
* If you are running lint from the command line instead of Eclipse, then the
analysis of Java files is pattern based rather than using an accurate parse
tree, so the results may not be accurate. (This limitation will go away
soon.)
* The analysis does not consider dependencies between projects, so if you have
a library project which defines resources and a project including the library
project referencing the resources, then the resources will still be reported
as unused.
UselessLeaf
-----------
Summary: Checks whether a leaf layout can be removed.
Priority: 2 / 10
Severity: Warning
Category: Performance
A layout that has no children or no background can often be removed (since it
is invisible) for a flatter and more efficient layout hierarchy.
UselessParent
-------------
Summary: Checks whether a parent layout can be removed.
Priority: 2 / 10
Severity: Warning
Category: Performance
A layout with children that has no siblings, is not a scrollview or a root
layout, and does not have a background, can be removed and have its children
moved directly into the parent for a flatter and more efficient layout
hierarchy.
TooDeepLayout
-------------
Summary: Checks whether a layout hierarchy is too deep
Priority: 1 / 10
Severity: Warning
Category: Performance
Layouts with too much nesting is bad for performance. Consider using a flatter
layout (such as RelativeLayout or GridLayout).The default maximum depth is 10
but can be configured with the environment variable ANDROID_LINT_MAX_DEPTH.
TooManyViews
------------
Summary: Checks whether a layout has too many views
Priority: 1 / 10
Severity: Warning
Category: Performance
Using too many views in a single layout in a layout is bad for performance.
Consider using compound drawables or other tricks for reducing the number of
views in this layout.
The maximum view count defaults to 80 but can be configured with the
environment variable ANDROID_LINT_MAX_VIEW_COUNT.
UnusedIds
---------
Summary: Looks for unused id's
Priority: 1 / 10
Severity: Warning
Category: Performance
NOTE: This issue is disabled by default!
You can enable it by adding --enable UnusedIds
This resource id definition appears not to be needed since it is not
referenced from anywhere. Having id definitions, even if unused, is not
necessarily a bad idea since they make working on layouts and menus easier, so
there is not a strong reason to delete these.
Usability
=========
TextFields
----------
Summary: Looks for text fields missing inputType or hint settings
Priority: 5 / 10
Severity: Warning
Category: Usability
Providing an inputType attribute on a text field improves usability because
depending on the data to be input, optimized keyboards can be shown to the
user (such as just digits and parentheses for a phone number). Similarly,a
hint attribute displays a hint to the user for what is expected in the text
field.
If you really want to keep the text field generic, you can suppress this
warning by setting inputType="text".
Usability:Icons
===============
IconNoDpi
---------
Summary: Finds icons that appear in both a -nodpi folder and a dpi folder
Priority: 7 / 10
Severity: Warning
Category: Usability:Icons
Bitmaps that appear in drawable-nodpi folders will not be scaled by the
Android framework. If a drawable resource of the same name appears *both* in a
-nodpi folder as well as a dpi folder such as drawable-hdpi, then the behavior
is ambiguous and probably not intentional. Delete one or the other, or use
different names for the icons.
GifUsage
--------
Summary: Checks for images using the GIF file format which is discouraged
Priority: 5 / 10
Severity: Warning
Category: Usability:Icons
The .gif file format is discouraged. Consider using .png (preferred) or .jpg
(acceptable) instead.
More information:
http://developer.android.com/guide/topics/resources/drawable-resource.html#BitmapIconDipSize
-----------
Summary: Ensures that icons across densities provide roughly the same
density-independent size
Priority: 5 / 10
Severity: Warning
Category: Usability:Icons
Checks the all icons which are provided in multiple densities, all compute to
roughly the same density-independent pixel (dip) size. This catches errors
where images are either placed in the wrong folder, or icons are changed to
new sizes but some folders are forgotten.
IconDuplicatesConfig
--------------------
Summary: Finds icons that have identical bitmaps across various configuration
parameters
Priority: 5 / 10
Severity: Warning
Category: Usability:Icons
If an icon is provided under different configuration parameters such as
drawable-hdpi or -v11, they should typically be different. This detector
catches cases where the same icon is provided in different configuration
folder which is usually not intentional.
IconExpectedSize
----------------
Summary: Ensures that launcher icons, notification icons etc have the correct
size
Priority: 5 / 10
Severity: Warning
Category: Usability:Icons
NOTE: This issue is disabled by default!
You can enable it by adding --enable IconExpectedSize
There are predefined sizes (for each density) for launcher icons. You should
follow these conventions to make sure your icons fit in with the overall look
of the platform.
More information:
http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html#sizeIconLocation
------------
Summary: Ensures that images are not defined in the density-independent
drawable folder
Priority: 5 / 10
Severity: Warning
Category: Usability:Icons
The res/drawable folder is intended for density-independent graphics such as
shapes defined in XML. For bitmaps, move it to drawable-mdpi and consider
providing higher and lower resolution versions in drawable-ldpi, drawable-hdpi
and drawable-xhdpi. If the icon *really* is density independent (for example a
solid color) you can place it in drawable-nodpi.
More information:
IconDensities
-------------
Summary: Ensures that icons provide custom versions for all supported
densities
Priority: 4 / 10
Severity: Warning
Category: Usability:Icons
Icons will look best if a custom version is provided for each of the major
screen density classes (low, medium, high, extra high). This lint check
identifies icons which do not have complete coverage across the densities.
Low density is not really used much anymore, so this check ignores the ldpi
density. To force lint to include it, set the environment variable
ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,
see http://developer.android.com/resources/dashboard/screens.html
More information: http://developer.android.com/guide/practices/screens_support.html
IconDuplicates
--------------
Summary: Finds duplicated icons under different names
Priority: 3 / 10
Severity: Warning
Category: Usability:Icons
If an icon is repeated under different names, you can consolidate and just use
one of the icons and delete the others to make your application smaller.
However, duplicated icons usually are not intentional and can sometimes point
to icons that were accidentally overwritten or accidentally not updated.
IconMissingDensityFolder
------------------------
Summary: Ensures that all the density folders are present
Priority: 3 / 10
Severity: Warning
Category: Usability:Icons
Icons will look best if a custom version is provided for each of the major
screen density classes (low, medium, high, extra high). This lint check
identifies folders which are missing, such as drawable-hdpi.
Low density is not really used much anymore, so this check ignores the ldpi
density. To force lint to include it, set the environment variable
ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,
see http://developer.android.com/resources/dashboard/screens.html
More information: http://developer.android.com/guide/practices/screens_support.html
Accessibility
=============
ContentDescription
------------------
Summary: Ensures that image widgets provide a contentDescription
Priority: 3 / 10
Severity: Warning
Category: Accessibility
Non-textual widgets like ImageViews and ImageButtons should use the
contentDescription attribute to specify a textual description of the widget
such that screen readers and other accessibility tools can adequately describe
the user interface.
Internationalization
====================
HardcodedText
-------------
Summary: Looks for hardcoded text attributes which should be converted to
resource lookup
Priority: 5 / 10
Severity: Warning
Category: Internationalization
Hardcoding text attributes directly in layout files is bad for several
reasons:
* When creating configuration variations (for example for landscape or
portrait)you have to repeat the actual text (and keep it up to date when
making changes)
* The application cannot be translated to other languages by just adding new
translations for existing string resources.