Android 的代码分析工具
是否有适用于 Android 的静态代码分析工具可以从尝试访问可能为 null 的对象(无需先检查它)中获取简单的内容,例如 NullPointerExceptions...
C# 项目上的 resharper 等工具可以很好地做到这一点,所以我我假设 Android 的 Java 也有类似的工具......
Is there any static code analysis tools for Android that would pick up simple things like NullPointerExceptions from trying to access an object that might be null (without checking for it first)...
Tools like resharper on C# projects do this quite well, so I'm presuming there is similar tools for Android's Java...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
从 ADT 16 开始,内置了用于静态代码分析的 Android Lint 工具。
http://tools.android.com/tips/lint/
Since ADT 16 there is build-int Android Lint tool for static code analysis.
http://tools.android.com/tips/lint/
它并不是 Android 特定的,而是 Java 特定的。
我知道的几个工具:
更完整的工具列表可以在 wikipedia 上找到。
It's not really android specific, it's Java specific.
Several tools I know of:
More complete list of tools can be found on wikipedia.
对于Android应用程序的静态分析,可以使用以下组合:
For static analysis of Android apps, you can use the following combination:
Android 特定:
DidFail
FlowDroid
IccTA(来自 FlowDroid 的创建者)
Android specific:
DidFail
FlowDroid
IccTA (from the creators of FlowDroid)
尝试 Jetbrains(resharper 的创建者)的 IntelliJ IDEA。它有很多像 resharper 一样的 java 代码检查功能,并支持开发 Android 应用程序。
Try IntelliJ IDEA from Jetbrains (the creator of resharper). It has a lot of java code inspections like resharper and support developing Android applications.
AndroidStudio 是 IntelliJ IDEA 之上的一个薄层,zloyrobot 指出它有很多检查。问题在于,检查次数太多,很难缩小查询范围,只挑选出真正好的东西。我为此目的开发了一个配置文件,并在此处描述了如何使用它: http://superliminal.com/computing/ idea_static_analysis.html
AndroidStudio is a thin layer on top of IntelliJ IDEA which zloyrobot points out has lots of inspections. The problem is that there are so many inspections that it is difficult to narrow down your queries to pick up only the really good stuff. I developed a profile for that purpose and describe how to use it here: http://superliminal.com/computing/idea_static_analysis.html