androidpermissionsfindbugslint

Clean up unused Android permissions


If I wanted to research how and where permissions [requested in the Mainfest.xml] were used in an Android app for the purposes of removing them is there an easy way of doing this? Does lint or findbugs offer some sort of support for tracking permissions used/abused in a project?


Solution

  • I came from the future to save your lives.

    Here (in the future), LINT does check for missing permissions as you can see on LINT checks.


    Here is the description of the LINT rule:

     ID ResourceType

     Description

    This inspection looks at Android API calls that have been annotated with various support annotations (such as RequiresPermission or UiThread) and flags any calls that are not using the API correctly as specified by the annotations. Examples of errors flagged by this inspection:

    • Passing the wrong type of resource integer (such as R.string) to an API that expects a different type (such as R.dimen).
    • Forgetting to invoke the overridden method (via super) in methods that require it
    • Calling a method that requires a permission without having declared that permission in the manifest
    • Passing a resource color reference to a method which expects an RGB integer value.

    ...and many more. For more information, see the documentation at http://developer.android.com/tools/debugging/annotations.html


    I'm using Android Studio 2.1.2.