Writing Custom Lint Warning To Check For Custom Annotation
Solution 1:
But I do not know how to proceed from here
I suggest to write a test for your Detector
first. Here is an example project which demonstrates how to write Detector
tests [1]. That way you can try and adjust your Detector
as you like.
How can I check if an annoation exists on a method
I suggest to have a look at Android's default detectors [2]. There you'll most probably find a good point to start. E.g. the AnnotationDetector
.
and raise a warning such that it will be visible in Android Studio?
If you integrate your custom rules correctly into your project, then Lint will raise the warning for you. Please have a look here [3] for different options on how to integrate custom rules in your project. Note: AFAIK warnings of custom rules will only reported when running the corresponding Gradle task. The "auto-highlight" of Android Studio does not work with custom rules.
Post a Comment for "Writing Custom Lint Warning To Check For Custom Annotation"