reference:
lint is one provided by AndroidStatic codeCheck tool, which reports every problem it detects and provides a descriptive message and severity level for the problem so that you can quickly determine which key improvements need to be prioritized.
The effect presented here is the display of lint detection.
Speaking of the limited use of api here, let's first look at the annotations SuppressLint and TargetApi:
TargetApi:
Through this annotation, we can specify the api version.
Eg:
Declared @TargetApi (11), although our android: minSdkVersion is 8, we can use the 11 version of the API and Lint will not go wrong. But pay attention to the api support version of the machine!
SuppressLint:
The above effect can also use @SuppressLint ('NewApi'), as the name implies, we can use the new API and ignore the static detection of Lint, but it is recommended to use the above method, the reason is to use @SuppressLint ('NewApi') (Ignored here is the detection of NewApi.) After that, then we use any level of API, Lint will not prompt an error, but we ca n’t judge the version in the method, because we do n’t know what level of API the method calls, @TargetApi (11) is different. We explicitly specify that the method can only call APIs lower than version 11, so we can judge the version.
In other words, this annotation can ignore some specific Lint detections.
Toolbar-> Analyze-> Inspect Code…
Configure on specific test items
Android lint tool is a code prompt tool integrated in Android studio. It is mainly responsible for optimizing your code, including xml and java files, which is very powerful. Performing lint testing i...
Android provides us with a great tool for checking when the program conforms to the specification (various warnings). Instructions:Right click on your project -> Android Tools -> Run Lint...
Lint is a code static scanning tool provided by Android Studio that analyzes potential bugs in the project. Lint configuration In Android Studio, you can view the configuration of Lint by using Settin...
1. Tool introduction 1. Check with lint / pmd / p3c tool. Among them, pmd / p3c is biased towards the java language itself, and lint tools are biased towards android. (We will consider adding C / C ++...
The first step is sonarQube and sonar-scanner to download and install the configuration sonarQube:https://www.sonarqube.org/downloads/ sonar-scanner:https://docs.sonarqube.org/display/SCAN/Analyzing+w...
Lint Introduction 1. Lint is a code scanning analysis tool provided by Android Studio. 2, Lint can help us discover code structure/quality issues while providing some solutions 3, every problem discov...
Today to find the apk file upload simulator is very slow, check found many resource file is not used when writing programs. Use check adt lint on the plug-do, but too many entries. As a programmer, th...
*This article has been authorized to be published exclusively by WeChat public account guolin_blog ( ) After reading this article, you will know: Foreword What is Lint A brief introduction to the way ...
As shown above: In the project, click Analyze -> Run Inspection by Name -> in the menu bar The input box pops up: After entering, it will pop up: Generally choose the entire project or a module,...
When writing code, in order to implement some functions, we need to use high-level APIs. For example, the apply method in SharedPreference's Editor is introduced for API 9. There is no problem using m...