Overview
Correctness | |
7 | warning Assert: Assertions |
31 | warning DefaultLocale: Implied default locale in case conversion |
1 | error InvalidPackage: Package not included in Android |
2 | warning OldTargetApi: Target SDK attribute is not targeting latest version |
2 | warning GradleDependency: Obsolete Gradle Dependency |
2 | warning GradleOverrides: Value overridden by Gradle build script |
1 | warning Deprecated: Using deprecated resources |
Security | |
1 | warning AllowBackup: AllowBackup/FullBackupContent Problems |
Performance | |
7 | warning NestedWeights: Nested layout weights |
22 | warning UnusedResources: Unused resources |
Usability | |
3 | warning ButtonStyle: Button should be borderless |
1 | warning GoogleAppIndexingWarning: Missing support for Firebase App Indexing |
Internationalization | |
2 | warning SetTextI18n: TextView Internationalization |
7 | warning HardcodedText: Hardcoded text |
Disabled Checks (21) |
Assertions
../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:558:
555 final long n = p.valuesSize(); 556 switch (p.packetType()) { 557 case EEG: 558 assert(eegBuffer.length >= n); 559 getEegChannelValues(eegBuffer,p); 560 eegStale = true; 561 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:563:
560 eegStale = true; 561 break; 562 case ACCELEROMETER: 563 assert(accelBuffer.length >= n); 564 getAccelValues(p); 565 accelStale = true; 566 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:569:
566 break; 567 568 case ALPHA_RELATIVE://add 569 assert(alphaBuffer.length >= n); 570 getEegChannelValues(alphaBuffer,p); 571 alphaStale = true; 572 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:574:
571 alphaStale = true; 572 break; 573 case BETA_RELATIVE://add 574 assert(betaBuffer.length >= n); 575 getEegChannelValues(betaBuffer,p); 576 betaStale = true; 577 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:579:
576 betaStale = true; 577 break; 578 case THETA_RELATIVE://add 579 assert(thetaBuffer.length >= n); 580 getEegChannelValues(thetaBuffer,p); 581 thetaStale = true; 582 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:584:
581 thetaStale = true; 582 break; 583 case DELTA_RELATIVE://add 584 assert(deltaBuffer.length >= n); 585 getEegChannelValues(deltaBuffer,p); 586 deltaStale = true; 587 break;../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:589:
586 deltaStale = true; 587 break; 588 case GAMMA_RELATIVE://add 589 assert(gammaBuffer.length >= n); 590 getEegChannelValues(gammaBuffer,p); 591 gammaStale = true; 592 break;
Assert
Correctness
Warning
Priority 6/10
Implied default locale in case conversion
../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:708:
705 DatabaseReference gammaRef = database.getReference("Gamma_relative"); 706 */ 707 private void updateElem(double[] buffer,EEGsignal signal){ 708 signal.setElem1(String.format("%6.2f", buffer[0])); 709 signal.setElem2(String.format("%6.2f", buffer[1])); 710 signal.setElem3(String.format("%6.2f", buffer[2])); 711 signal.setElem4(String.format("%6.2f", buffer[3]));../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:709:
706 */ 707 private void updateElem(double[] buffer,EEGsignal signal){ 708 signal.setElem1(String.format("%6.2f", buffer[0])); 709 signal.setElem2(String.format("%6.2f", buffer[1])); 710 signal.setElem3(String.format("%6.2f", buffer[2])); 711 signal.setElem4(String.format("%6.2f", buffer[3])); 712 }../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:710:
707 private void updateElem(double[] buffer,EEGsignal signal){ 708 signal.setElem1(String.format("%6.2f", buffer[0])); 709 signal.setElem2(String.format("%6.2f", buffer[1])); 710 signal.setElem3(String.format("%6.2f", buffer[2])); 711 signal.setElem4(String.format("%6.2f", buffer[3])); 712 } 713 private void updateAccel() {../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:711:
708 signal.setElem1(String.format("%6.2f", buffer[0])); 709 signal.setElem2(String.format("%6.2f", buffer[1])); 710 signal.setElem3(String.format("%6.2f", buffer[2])); 711 signal.setElem4(String.format("%6.2f", buffer[3])); 712 } 713 private void updateAccel() { 714 TextView acc_x = (TextView)findViewById(R.id.acc_x);../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:717:
714 TextView acc_x = (TextView)findViewById(R.id.acc_x); 715 TextView acc_y = (TextView)findViewById(R.id.acc_y); 716 TextView acc_z = (TextView)findViewById(R.id.acc_z); 717 acc_x.setText(String.format("%6.2f", accelBuffer[0])); 718 acc_y.setText(String.format("%6.2f", accelBuffer[1])); 719 acc_z.setText(String.format("%6.2f", accelBuffer[2])); 720 }+ 26 More Occurrences...
DefaultLocale
Correctness
Warning
Priority 6/10
Package not included in Android
InvalidPackage
Correctness
Error
Priority 6/10
Target SDK attribute is not targeting latest version
../../src/main/AndroidManifest.xml:15:
12 13 <uses-sdk 14 android:minSdkVersion="15" 15 android:targetSdkVersion="23" /> 16 17 <application 18 android:allowBackup="true"../../build.gradle:10:
7 defaultConfig { 8 applicationId "com.choosemuse.example.libmuse2" 9 minSdkVersion 15 10 targetSdkVersion 23 11 compileOptions { 12 sourceCompatibility JavaVersion.VERSION_1_7 13 targetCompatibility JavaVersion.VERSION_1_7
OldTargetApi
Correctness
Warning
Priority 6/10
Obsolete Gradle Dependency
../../build.gradle:5:
2 3 android { 4 compileSdkVersion 23 5 buildToolsVersion '25.0.0' 6 7 defaultConfig { 8 applicationId "com.choosemuse.example.libmuse2"../../build.gradle:33:
30 31 dependencies { 32 compile files('libs/libmuse_android.jar') 33 compile 'com.android.support:support-v4:23.1.1' 34 35 compile('io.socket:socket.io-client:0.8.3') { 36 exclude group: 'org.json', module: 'json'
GradleDependency
Correctness
Warning
Priority 4/10
Value overridden by Gradle build script
../../src/main/AndroidManifest.xml:14:
11 <uses-permission android:name="android.permission.INTERNET"/> 12 13 <uses-sdk 14 android:minSdkVersion="15" 15 android:targetSdkVersion="23" /> 16 17 <application../../src/main/AndroidManifest.xml:15:
12 13 <uses-sdk 14 android:minSdkVersion="15" 15 android:targetSdkVersion="23" /> 16 17 <application 18 android:allowBackup="true"
GradleOverrides
Correctness
Warning
Priority 4/10
Using deprecated resources
../../src/main/res/layout/activity_login.xml:29:
26 android:inputType="textPersonName" 27 android:maxLength="14" 28 android:maxLines="1" 29 android:singleLine="true"/> 30 <Button 31 android:id="@+id/sign_in_button" 32 style="?android:textAppearanceSmall"
Deprecated
Correctness
Warning
Priority 2/10
AllowBackup/FullBackupContent Problems
../../src/main/AndroidManifest.xml:17:
14 android:minSdkVersion="15" 15 android:targetSdkVersion="23" /> 16 17 <application 18 android:allowBackup="true" 19 android:icon="@drawable/ic_launcher" 20 android:label="@string/app_name"
AllowBackup
Security
Warning
Priority 3/10
Nested layout weights
../../src/main/res/layout/activity_main.xml:92:
89 android:id="@+id/eeg_tp9" 90 android:layout_width="match_parent" 91 android:layout_height="match_parent" 92 android:layout_weight="1" 93 android:textSize="16sp" 94 android:text="@string/init_val" /> 95 <TextView../../src/main/res/layout/activity_main.xml:136:
133 android:id="@+id/acc_x" 134 android:layout_width="match_parent" 135 android:layout_height="match_parent" 136 android:layout_weight="1" 137 android:text="@string/init_val" 138 android:textSize="16sp" />../../src/main/res/layout/activity_main.xml:174:
171 android:id="@+id/Aelem1" 172 android:layout_width="match_parent" 173 android:layout_height="match_parent" 174 android:layout_weight="1" 175 android:textSize="16sp" 176 android:text="@string/init_val" /> 177 <TextView../../src/main/res/layout/activity_main.xml:216:
213 android:id="@+id/Belem1" 214 android:layout_width="match_parent" 215 android:layout_height="match_parent" 216 android:layout_weight="1" 217 android:textSize="16sp" 218 android:text="@string/init_val" /> 219 <TextView../../src/main/res/layout/activity_main.xml:258:
255 android:id="@+id/Telem1" 256 android:layout_width="match_parent" 257 android:layout_height="match_parent" 258 android:layout_weight="1" 259 android:textSize="16sp" 260 android:text="@string/init_val" /> 261 <TextView../../src/main/res/layout/activity_main.xml:300:
297 android:id="@+id/Delem1" 298 android:layout_width="match_parent" 299 android:layout_height="match_parent" 300 android:layout_weight="1" 301 android:textSize="16sp" 302 android:text="@string/init_val" /> 303 <TextView../../src/main/res/layout/activity_main.xml:343:
340 android:id="@+id/Gelem1" 341 android:layout_width="match_parent" 342 android:layout_height="match_parent" 343 android:layout_weight="1" 344 android:textSize="16sp" 345 android:text="@string/init_val" /> 346 <TextView
NestedWeights
Performance
Warning
Priority 3/10
Unused resources
../../src/main/res/values/colors.xml:3:
1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <color name="colorPrimary">#03A9F4</color> 4 <color name="colorPrimaryDark">#0288D1</color> 5 <color name="colorAccent">#FF5722</color> 6 </resources>../../src/main/res/values/colors.xml:4:
1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <color name="colorPrimary">#03A9F4</color> 4 <color name="colorPrimaryDark">#0288D1</color> 5 <color name="colorAccent">#FF5722</color> 6 </resources>../../src/main/res/values/colors.xml:5:
2 <resources> 3 <color name="colorPrimary">#03A9F4</color> 4 <color name="colorPrimaryDark">#0288D1</color> 5 <color name="colorAccent">#FF5722</color> 6 </resources>../../src/main/res/menu/main.xml:1:
1 <menu xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 tools:context="com.choosemuse.example.libmuse.MainActivity" >../../src/main/res/values/strings.xml:7:
4 <string name="app_name">TestLibMuseAndroid</string> 5 <string name="title_activity_login">Sign in</string> 6 7 <string name="hello_world">Hello world!</string> 8 <string name="action_settings">Settings</string> 9 <string name="connect">Connect</string> 10 <string name="status">Connection Status:</string>+ 17 More Occurrences...
UnusedResources
Performance
Warning
Priority 3/10
Button should be borderless
../../src/main/res/layout/activity_main.xml:15:
12 android:layout_width="match_parent" 13 android:layout_height="45dp" 14 android:orientation="horizontal" > 15 <Button 16 android:id="@+id/refresh" 17 android:layout_width="100dp" 18 android:layout_height="40dp"../../src/main/res/layout/activity_main.xml:20:
17 android:layout_width="100dp" 18 android:layout_height="40dp" 19 android:text="@string/refresh" /> 20 <Button 21 android:id="@+id/connect" 22 android:layout_width="100dp" 23 android:layout_height="40dp"../../src/main/res/layout/activity_main.xml:25:
22 android:layout_width="100dp" 23 android:layout_height="40dp" 24 android:text="@string/connect" /> 25 <Button 26 android:id="@+id/disconnect" 27 android:layout_width="120dp" 28 android:layout_height="40dp"
ButtonStyle
Usability
Warning
Priority 5/10
Missing support for Firebase App Indexing
../../src/main/AndroidManifest.xml:17:
14 android:minSdkVersion="15" 15 android:targetSdkVersion="23" /> 16 17 <application 18 android:allowBackup="true" 19 android:icon="@drawable/ic_launcher" 20 android:label="@string/app_name"
GoogleAppIndexingWarning
Usability
Warning
Priority 5/10
TextView Internationalization
../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:1074:
1071 } 1072 1073 mUsername = data.getStringExtra("username"); 1074 mUserNameTx.setText("Hello "+ mUsername); 1075 int numUsers = data.getIntExtra("numUsers", 1); 1076 1077 //addLog(getResources().getString(R.string.message_welcome));../../src/main/java/com/choosemuse/example/libmuse/MainActivity.java:1074:
1071 } 1072 1073 mUsername = data.getStringExtra("username"); 1074 mUserNameTx.setText("Hello "+ mUsername); 1075 int numUsers = data.getIntExtra("numUsers", 1); 1076 1077 //addLog(getResources().getString(R.string.message_welcome));
SetTextI18n
Internationalization
Warning
Priority 6/10
Hardcoded text
../../src/main/res/layout/activity_login.xml:36:
33 android:layout_width="match_parent" 34 android:layout_height="wrap_content" 35 android:layout_marginTop="16dp" 36 android:text="sign_in" 37 android:textStyle="bold"/> 38 39 </LinearLayout>../../src/main/res/layout/activity_main.xml:53:
50 android:layout_marginLeft="8dp" 51 android:layout_marginRight="8dp" 52 android:layout_marginTop="8dp" 53 android:text="TextView" 54 /> 55 56 <TextView../../src/main/res/layout/activity_main.xml:64:
61 android:layout_marginLeft="8dp" 62 android:layout_marginRight="8dp" 63 android:layout_marginTop="8dp" 64 android:text="TextView" 65 /> 66 67 <com.github.mikephil.charting.charts.LineChart../../src/main/res/layout/activity_main.xml:206:
203 android:layout_height="match_parent" 204 android:layout_weight="1" 205 android:textSize="16sp" 206 android:text="BETA relative" /> 207 <LinearLayout 208 android:layout_width="match_parent" 209 android:layout_height="match_parent"../../src/main/res/layout/activity_main.xml:248:
245 android:layout_height="match_parent" 246 android:layout_weight="1" 247 android:textSize="16sp" 248 android:text="THETA relative" /> 249 <LinearLayout 250 android:layout_width="match_parent" 251 android:layout_height="match_parent"../../src/main/res/layout/activity_main.xml:290:
287 android:layout_height="match_parent" 288 android:layout_weight="1" 289 android:textSize="16sp" 290 android:text="DELTA relative" /> 291 <LinearLayout 292 android:layout_width="match_parent" 293 android:layout_height="match_parent"../../src/main/res/layout/activity_main.xml:332:
329 android:layout_height="match_parent" 330 android:layout_weight="1" 331 android:textSize="16sp" 332 android:text="GAMMA relative" /> 333 334 <LinearLayout 335 android:layout_width="match_parent"
HardcodedText
Internationalization
Warning
Priority 5/10
Disabled Checks
One or more 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.
Suppressing Warnings and Errors
Lint errors can be suppressed in a variety of ways:
1. With a
2. With a
3. With a //noinspection comment in the source code
4. With ignore flags specified in the
5. With a
6. With a
7. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a
To suppress a lint warning with a comment, add a
To suppress a lint warning in an XML file, add a
To suppress a lint warning in a
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use
To suppress lint warnings with a configuration XML file, create a file named
The format of the
<?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:
For more information, see http://g.co/androidstudio/suppressing-lint-warnings
1. With a
@SuppressLint
annotation in the Java code2. With a
tools:ignore
attribute in the XML file3. With a //noinspection comment in the source code
4. With ignore flags specified in the
build.gradle
file, as explained below5. With a
lint.xml
configuration file in the project6. With a
lint.xml
configuration file passed to lint via the --config flag7. 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 with a comment, add a
//noinspection id
comment on the line before the statement with the error.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 module 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://g.co/androidstudio/suppressing-lint-warnings