Lint Report: 11 warnings
Issue Types

Overview

Correctness
8warning DefaultLocale: Implied default locale in case conversion
1warning OldTargetApi: Target SDK attribute is not targeting latest version
1warning SimpleDateFormat: Implied locale in date format
1warning GradleDependency: Obsolete Gradle Dependency
Disabled Checks (29)

Implied default locale in case conversion

../../src/main/java/h/com/serialportapi/util/ByteUtil.java:39: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
  36             buffer[1] = Character.forDigit(src[i] & 0x0F, 16);
  37             builder.append(buffer);
  38         }
  39         return builder.toString().toUpperCase();                                                    
  40     }
  41 
  42     /**
../../src/main/java/h/com/serialportapi/util/ByteUtil.java:73: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
  70      * @return
  71      */
  72     public static String decimal2fitHex(long num) {
  73         String hex = Long.toHexString(num).toUpperCase();                                           
  74         if (hex.length() % 2 != 0) {
  75             return "0" + hex;
  76         }
../../src/main/java/h/com/serialportapi/util/ByteUtil.java:77: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
  74         if (hex.length() % 2 != 0) {
  75             return "0" + hex;
  76         }
  77         return hex.toUpperCase();                                                                   
  78     }
  79 
  80     /**
../../src/main/java/h/com/serialportapi/util/ByteUtil.java:139: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
 136     public static byte[] hexStr2bytes(String hex) {
 137         int len = (hex.length() / 2);
 138         byte[] result = new byte[len];
 139         char[] achar = hex.toUpperCase().toCharArray();                                             
 140         for (int i = 0; i < len; i++) {
 141             int pos = i * 2;
 142             result[i] = (byte) (hexChar2byte(achar[pos]) << 4 | hexChar2byte(achar[pos + 1]));
../../src/main/java/h/com/serialportapi/comn/CommPacket.java:829: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
 826         } else {
 827             //return String.valueOf((sendData.length() / 2) + 1);
 828             if (Integer.toHexString((sendData.length() / 2) + 1).length() == 1) {
 829                 return "0" + Integer.toHexString((sendData.length() / 2)).toUpperCase();            
 830             } else {
 831                 return Integer.toHexString((sendData.length() / 2)).toUpperCase();
 832             }
../../src/main/java/h/com/serialportapi/comn/CommPacket.java:831: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
 828             if (Integer.toHexString((sendData.length() / 2) + 1).length() == 1) {
 829                 return "0" + Integer.toHexString((sendData.length() / 2)).toUpperCase();
 830             } else {
 831                 return Integer.toHexString((sendData.length() / 2)).toUpperCase();                  
 832             }
 833         }
 834     }
../../src/main/java/h/com/serialportapi/comn/Packet.java:76: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
 73             if (hex.length() == 1) {
 74                 hex = '0' + hex;
 75             }
 76             ret += " 0x" + hex.toUpperCase();                                                       
 77         }
 78         return ret;
 79     }
../../src/main/java/h/com/serialportapi/comn/SerialReadThread.java:298: Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
 295         if (hex.length() == 1) {
 296             hex = "0" + hex;
 297         }
 298         return hex.toUpperCase();                                                                   
 299     }
 300 
 301     private void postMessage(String hexStr) {
DefaultLocale Correctness Warning Priority 6/10

Target SDK attribute is not targeting latest version

../../build.gradle:7: Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.
  4     compileSdkVersion 26
  5     defaultConfig {
  6         minSdkVersion 19
  7         targetSdkVersion 26
                                                                        
  8         versionCode 1
  9         versionName "1.0"
 10 
OldTargetApi Correctness Warning Priority 6/10

Implied locale in date format

../../src/main/java/h/com/serialportapi/util/TimeUtil.java:13: To get local formatting use getDateInstance(), getDateTimeInstance(), or getTimeInstance(), or use new SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates.
 10 public class TimeUtil {
 11 
 12     public static final SimpleDateFormat DEFAULT_FORMAT =
 13         new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");                                            
 14 
 15     public static String currentTime() {
 16         Date date = new Date();
SimpleDateFormat Correctness Warning Priority 6/10

Obsolete Gradle Dependency

../../build.gradle:50: A newer version of io.reactivex.rxjava2:rxjava than 2.1.8 is available: 2.1.9
 47     // 串口

 48     implementation 'com.github.licheedev.Android-SerialPort-API:serialport:1.0.1'
 49     //rx

 50     implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
                                             
 51     implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
 52     // eventbus

 53     implementation 'org.greenrobot:eventbus:3.1.1'
GradleDependency Correctness Warning Priority 4/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 @SuppressLint annotation in the Java code
2. With a tools:ignore attribute in the XML file
3. With a //noinspection comment in the source code
4. With ignore flags specified in the build.gradle file, as explained below
5. With a lint.xml configuration file in the project
6. With a lint.xml configuration file passed to lint via the --config flag
7. 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>
    <!-- Ignore everything in the test source set -->
    <issue id="all">
        <ignore path="*/test/*" />
    </issue>

    <!-- 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" />
        <ignore regexp="(foo|bar).java" />
    </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