Lint Report
Check performed at Wed Jun 10 11:49:36 UTC 2015.
0 errors and 25 warnings found:
../../src/main/res/layout/activity_main.xml:38:
Attribute elegantTextHeight
is only used in API level 21 and higher (current min is 19)
35 android:text="@string/activityMainExerciseButton"
36 android:layout_marginTop="25dp"
37 android:enabled="true"
38 android:elegantTextHeight="false"
39 android:clickable="true"
40 android:minHeight="125dp"
Priority: 6 / 10
Category: Correctness
Severity:
Warning
Explanation: Attribute unused on older versions.
This check finds attributes set in XML files that were introduced in a version newer than the oldest version targeted by your application (with the minSdkVersion
attribute).
This is not an error; the application will simply ignore the attribute. However, if the attribute is important to the appearance of functionality of your application, you should consider finding an alternative way to achieve the same result with only available attributes, and then you can optionally create a copy of the layout in a layout-vNN folder which will be used on API NN or higher where you can take advantage of the newer attribute.
Note: This check does not only apply to attributes. For example, some tags can be unused too, such as the new <tag>
element in layouts introduced in API 21.
More info:
To suppress this error, use the issue id "UnusedAttribute" as explained in the
Suppressing Warnings and Errors section.
../../build.gradle:31:
A newer version of com.google.android.gms:play-services than 7.0.0 is available: 7.5.0
28 compile files('libs/accessory-v2.2.2.jar')
29 compile files('libs/jahmm-0.6.1.jar')
30 compile files('libs/sdk-v1.0.0.jar')
31 compile 'com.google.android.gms:play-services:7.0.0'
32 testCompile 'junit:junit:4.12'
33 }
Severity:
Warning
Explanation: Obsolete Gradle Dependency.
This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
More info:
To suppress this error, use the issue id "GradleDependency" as explained in the
Suppressing Warnings and Errors section.
../../src/main/res/layout/activity_train.xml:21:
Invalid layout param in a LinearLayout
: layout_alignParentTop
18 android:layout_width="wrap_content"
19 android:layout_height="458dp"
20 android:id="@+id/exeListView"
21 android:layout_alignParentTop="true"
22 android:layout_alignParentStart="true"
23 android:layout_weight="0.97"/>
../../src/main/res/layout/activity_train.xml:22:
Invalid layout param in a LinearLayout
: layout_alignParentStart
19 android:layout_height="458dp"
20 android:id="@+id/exeListView"
21 android:layout_alignParentTop="true"
22 android:layout_alignParentStart="true"
23 android:layout_weight="0.97"/>
24
../../src/main/res/layout/activity_train.xml:30:
Invalid layout param in a LinearLayout
: layout_centerHorizontal
27 android:layout_height="wrap_content"
28 android:text="Learn"
29 android:id="@+id/learnExercise"
30 android:layout_centerHorizontal="true"
31 android:layout_gravity="center_vertical"
32 />
Severity:
Warning
Explanation: Obsolete layout params.
The given layout_param is not defined for the given layout, meaning it has no effect. This usually happens when you change the parent layout or move view code around without updating the layout params. This will cause useless attribute processing at runtime, and is misleading for others reading the layout so the parameter should be removed.
More info:
To suppress this error, use the issue id "ObsoleteLayoutParam" as explained in the
Suppressing Warnings and Errors section.
Priority: 4 / 10
Category: Performance
Severity:
Warning
Explanation: Handler reference leaks.
Since this Handler is declared as an inner class, it may prevent the outer class from being garbage collected. If the Handler is using a Looper or MessageQueue for a thread other than the main thread, then there is no issue. If the Handler is using the Looper or MessageQueue of the main thread, you need to fix your Handler declaration, as follows: Declare the Handler as a static class; In the outer class, instantiate a WeakReference to the outer class and pass this object to your Handler when you instantiate the Handler; Make all references to members of the outer class using the WeakReference object.
More info:
To suppress this error, use the issue id "HandlerLeak" as explained in the
Suppressing Warnings and Errors section.
Severity:
Warning
Explanation: Should use valueOf
instead of new
You should not call the constructor for wrapper classes directly, such as`new Integer(42)`. Instead, call the valueOf
factory method, such as Integer.valueOf(42)
. This will typically use less memory because common integers such as 0 and 1 will share a single instance.
More info:
To suppress this error, use the issue id "UseValueOf" as explained in the
Suppressing Warnings and Errors section.
../../src/main/res/layout/activity_train.xml:19:
Use a layout_height
of 0dp
instead of 458dp
for better performance
16
17 <ListView
18 android:layout_width="wrap_content"
19 android:layout_height="458dp"
20 android:id="@+id/exeListView"
21 android:layout_alignParentTop="true"
Severity:
Warning
Explanation: Inefficient layout weight.
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.
More info:
To suppress this error, use the issue id "InefficientWeight" as explained in the
Suppressing Warnings and Errors section.
Priority: 3 / 10
Category: Performance
Severity:
Warning
Explanation: Unused resources.
Unused resources make applications larger and slow down builds.
More info:
To suppress this error, use the issue id "UnusedResources" as explained in the
Suppressing Warnings and Errors section.
../../src/main/res/layout/activity_learn_list.xml:9:
This LinearLayout
layout or its LinearLayout
parent is useless
6 android:orientation="horizontal"
7 android:id="@+id/topLayout">
8
9 <LinearLayout
10 android:orientation="vertical"
11 android:layout_width="match_parent"
../../src/main/res/layout/activity_train.xml:11:
This LinearLayout
layout or its RelativeLayout
parent is useless
8 android:paddingBottom="@dimen/activity_vertical_margin"
9 tools:context="nl.fontys.exercisecontrol.TrainActivity">
10
11 <LinearLayout
12 android:orientation="vertical"
13 android:layout_width="fill_parent"
Severity:
Warning
Explanation: Useless parent layout.
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.
More info:
To suppress this error, use the issue id "UselessParent" as explained in the
Suppressing Warnings and Errors section.
../../src/main/res/layout/activity_history.xml:14:
[I18N] Hardcoded string "Return", should use @string
resource
11 <Button
12 android:layout_width="wrap_content"
13 android:layout_height="wrap_content"
14 android:text="Return"
15 android:id="@+id/returnButton"
16 android:layout_alignParentBottom="true"
../../src/main/res/layout/activity_learn_list.xml:18:
[I18N] Hardcoded string "cdxfhcfjhxchxvhvckvxcv", should use @string
resource
15 android:layout_width="wrap_content"
16 android:layout_height="wrap_content"
17 android:textAppearance="?android:attr/textAppearanceMedium"
18 android:text="cdxfhcfjhxchxvhvckvxcv"
19 android:id="@+id/sequence_textView"
20 android:layout_gravity="left"
../../src/main/res/layout/activity_learn_list.xml:26:
[I18N] Hardcoded string "X", should use @string
resource
23 <Button
24 android:layout_width="match_parent"
25 android:layout_height="wrap_content"
26 android:text="X"
27 android:id="@+id/deleteSeq_Button"
28 android:layout_gravity="right"
../../src/main/res/layout/activity_train.xml:28:
[I18N] Hardcoded string "Learn", should use @string
resource
25 <Button
26 android:layout_width="match_parent"
27 android:layout_height="wrap_content"
28 android:text="Learn"
29 android:id="@+id/learnExercise"
30 android:layout_centerHorizontal="true"
Severity:
Warning
Explanation: Hardcoded text.
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.
In Android Studio and Eclipse there are quickfixes to automatically extract this hardcoded string into a resource lookup.
More info:
To suppress this error, use the issue id "HardcodedText" as explained in the
Suppressing Warnings and Errors section.
../../src/main/res/layout/activity_exercise_description.xml:41:
Consider replacing android:layout_alignParentLeft
with android:layout_alignParentStart="false"
to better support right-to-left layouts
38 android:layout_marginTop="50dp"
39 android:layout_marginBottom="50dp"
40 android:layout_alignParentEnd="false"
41 android:layout_alignParentLeft="false"
42 android:layout_alignParentRight="false"/>
43
../../src/main/res/layout/activity_exercise_description.xml:42:
Redundant attribute layout_alignParentRight
; already defining layout_alignParentEnd
with targetSdkVersion
21
39 android:layout_marginBottom="50dp"
40 android:layout_alignParentEnd="false"
41 android:layout_alignParentLeft="false"
42 android:layout_alignParentRight="false"/>
43
44 <Button
../../src/main/res/layout/activity_exercise_description.xml:52:
Redundant attribute layout_alignParentLeft
; already defining layout_alignParentStart
with targetSdkVersion
21
49 android:layout_alignParentBottom="true"
50 android:layout_alignParentStart="true"
51 android:layout_alignEnd="@+id/ExerciseNameTextView"
52 android:layout_alignParentLeft="true"
53 android:layout_alignParentRight="true"/>
54 </RelativeLayout>
../../src/main/res/layout/activity_exercise_description.xml:53:
Consider replacing android:layout_alignParentRight
with android:layout_alignParentEnd="true"
to better support right-to-left layouts
50 android:layout_alignParentStart="true"
51 android:layout_alignEnd="@+id/ExerciseNameTextView"
52 android:layout_alignParentLeft="true"
53 android:layout_alignParentRight="true"/>
54 </RelativeLayout>
55
../../src/main/res/layout/activity_learn_list.xml:20:
Use "start
" instead of "left
" to ensure correct behavior in right-to-left locales
17 android:textAppearance="?android:attr/textAppearanceMedium"
18 android:text="cdxfhcfjhxchxvhvckvxcv"
19 android:id="@+id/sequence_textView"
20 android:layout_gravity="left"
21 android:layout_marginTop="15dp"/>
22
../../src/main/res/layout/activity_learn_list.xml:28:
Use "end
" instead of "right
" to ensure correct behavior in right-to-left locales
25 android:layout_height="wrap_content"
26 android:text="X"
27 android:id="@+id/deleteSeq_Button"
28 android:layout_gravity="right"
29 android:layout_marginTop="10dp"/>
30 </LinearLayout>
Priority: 5 / 10
Category: Bi-directional Text
Severity:
Warning
Explanation: Using left/right instead of start/end attributes.
Using Gravity#LEFT
and Gravity#RIGHT
can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START
and Gravity#END
instead. Similarly, in XML gravity
and layout_gravity
attributes, use start
rather than left
.
For XML attributes such as paddingLeft and layout_marginLeft
, use paddingStart
and layout_marginStart
. NOTE: If your minSdkVersion
is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error.
(Note: For Gravity#LEFT
and Gravity#START
, you can use these constants even when targeting older platforms, because the start
bitmask is a superset of the left
bitmask. Therefore, you can use gravity="start"
rather than gravity="left|start"
.)
More info:
To suppress this error, use the issue id "RtlHardcoded" as explained in the
Suppressing Warnings and Errors section.
The following issues were not run by lint, either because the check is not enabled by default, or because it was disabled with a command line flag or via one or more lint.xml configuration files in the project directories.
Disabled By: Default
Priority: 6 / 10
Category: Usability
Severity:
Warning
Explanation: Back button.
According to the Android Design Guide,
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.
To suppress this error, use the issue id "BackButton" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 6 / 10
Category: Security
Severity:
Warning
Explanation: Code contains easter egg.
An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight.
More info:
To suppress this error, use the issue id "EasterEgg" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 4 / 10
Category: Performance
Severity:
Warning
Explanation: Using getter instead of field.
Accessing a field within the class that defines a getter for that field is at least 3 times faster than calling the getter. For simple getters that do nothing other than return the field, you might want to just reference the local field directly instead.
NOTE: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.
To suppress this error, use the issue id "FieldGetter" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 5 / 10
Category: Usability:Icons
Severity:
Warning
Explanation: Icon has incorrect size.
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.
To suppress this error, use the issue id "IconExpectedSize" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 5 / 10
Category: Performance
Severity:
Warning
Explanation: Unconditional Logging Calls.
The BuildConfig class (available in Tools 17) provides a constant, "DEBUG", which indicates whether the code is being built in release mode or in debug mode. In release mode, you typically want to strip out all the logging calls. Since the compiler will automatically remove all code which is inside a "if (false)" check, surrounding your logging calls with a check for BuildConfig.DEBUG is a good idea.
If you really intend for the logging to be present in release mode, you can suppress this warning with a @SuppressLint annotation for the intentional logging calls.
More info:
To suppress this error, use the issue id "LogConditional" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 4 / 10
Category: Usability
Severity:
Warning
Explanation: Negative Margins.
Margin values should be positive. Negative values are generally a sign that you are making assumptions about views surrounding the current one, or may be tempted to turn off child clipping to allow a view to escape its parent. Turning off child clipping to do this not only leads to poor graphical performance, it also results in wrong touch event handling since touch events are based strictly on a chain of parent-rect hit tests. Finally, making assumptions about the size of strings can lead to localization problems.
More info:
To suppress this error, use the issue id "NegativeMargin" as explained in the
Suppressing Warnings and Errors section.
Severity:
Warning
Explanation: Newer Library Versions Available.
This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project.
This is similar to the GradleDependency
check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.
More info:
To suppress this error, use the issue id "NewerVersionAvailable" as explained in the
Suppressing Warnings and Errors section.
Severity:
Warning
Explanation: Dynamic text should probably be selectable.
If a <TextView>
is used to display data, the user might want to copy that data and paste it elsewhere. To allow this, the <TextView>
should specify android:textIsSelectable="true"
.
This lint check looks for TextViews which are likely to be displaying data: views whose text is set dynamically. This value will be ignored on platforms older than API 11, so it is okay to set it regardless of your minSdkVersion
.
More info:
To suppress this error, use the issue id "SelectableText" as explained in the
Suppressing Warnings and Errors section.
Severity:
Warning
Explanation: Code contains STOPSHIP
marker.
Using the comment // STOPSHIP
can be used to flag code that is incomplete but checked in. This comment marker can be used to indicate that the code should not be shipped until the issue is addressed, and lint will look for these.
More info:
To suppress this error, use the issue id "StopShip" as explained in the
Suppressing Warnings and Errors section.
Severity:
Warning
Explanation: Straight quotes can be replaced with curvy quotes.
Straight single quotes and double quotes, when used as a pair, can be replaced by "curvy quotes" (or directional quotes). This can make the text more readable.
Note that you should never use grave accents and apostrophes to quote, `like this'.
(Also note that you should not use curvy quotes for code fragments.)
To suppress this error, use the issue id "TypographyQuotes" as explained in the
Suppressing Warnings and Errors section.
Disabled By: Default
Priority: 1 / 10
Category: Performance
Severity:
Warning
Explanation: Unused id.
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.
More info:
To suppress this error, use the issue id "UnusedIds" as explained in the
Suppressing Warnings and Errors section.
Suppressing Warnings and Errors
Lint errors can be suppressed in a variety of ways:
1. With a @SuppressLint
annotation in the Java code
2. With a tools:ignore
attribute in the XML file
3. With ignore flags specified in the build.gradle
file, as explained below
4. With a lint.xml
configuration file in the project
5. With a lint.xml
configuration file passed to lint via the --config flag
6. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a @SuppressLint("id")
annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as "UnusedResources"
or {"UnusedResources","UnusedIds"}
, or it can be "all"
to suppress all lint warnings in the given scope.
To suppress a lint warning in an XML file, add a tools:ignore="id"
attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the xmlns:android
declaration:
xmlns:tools="http://schemas.android.com/tools"
To suppress a lint warning in a build.gradle
file, add a section like this:
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use warning
or error
instead of disable
to change the severity of issues.
To suppress lint warnings with a configuration XML file, create a file named lint.xml
and place it at the root directory of the project in which it applies.
The format of the lint.xml
file is something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
$ lint --ignore UnusedResources,UselessLeaf /my/project/path
For more information, see http://tools.android.com/tips/lint/suppressing-lint-warnings