Android has Lint for checking errors in Java and XML code. Lint release with every new SDK.
But Lint is not find most type of bugs,exceptions and performance issue.
I found one plugin for static analysis tools to analysis android Java code.
It helps to improve code quality and application performance.
FindBugs divided Issues into 9 categories that are:
- Dodgy code
- Malicious code vulnerability
- Bad practice
- Correctness
- Internationalization
- Security
- Performance
- Multi-threaded correctness
- Experimental
Steps to Add plugin into Android Studio
1. Open File.
2. Click on Settings
3. then Plugins and search for FindBugs.
Now Run FindBugs for your project/file.
FindBugs report many issues like "Bad Practice" when you run first time. That issues are part of automatically generated files.
For ignore issues like this FindBugs has functionality to add exclude issues.
To ignore "Bad Practice issue" for automatically generated files and code Create xml file in root of project and Add the below code to it.
<?xml version="1.0" encoding="UTF-8"?>
< FindBugsFilter>
< Match>
< !-- ignore all issues in resource generation -->
< Class name="~.*\.R\$.*"/>
< /Match>
< Match>
< Class name="~.*\.Manifest\$.*"/>
< /Match>
< /FindBugsFilter>
Open Settings and click on FindBugs.
Click on Filter then click on Add Exclude filter.
add above generated xml file and test your code.
Please let me know if there is any query.
References:- FindBugs plugin
Happy Coding.
Cheers!!
![alt text](http://findnerd.com/imagedata/3166/3166.png)
![image1](http://findnerd.s3.amazonaws.com/imagedata/3164/3164.png)
![alt text](http://findnerd.s3.amazonaws.com/imagedata/3165/3165.png)
0 Comment(s)