Java – suppresses “Log.v(TAG, …)” Lint warnings within hard-coded strings

suppresses “Log.v(TAG, …)” Lint warnings within hard-coded strings… here is a solution to the problem.

suppresses “Log.v(TAG, …)” Lint warnings within hard-coded strings

I’m asking myself if it’s possible to suppress lint warning “hardcoded string” if the hardcoded string is an argument to the logging method “Log.v(tag, msg)”….

I’m using logging for debugging, but I don’t want to outsource these strings in a resource file….

Thanks for the answer!

Solution

i was wondering the same thing, but as a fallback, I know you can add //NON-NLS to every line that contains a hardcoded string. They will then be ignored by lint validation. Although, this solution is far from optimal when you have thousands of files to change. The ideal option is to redefine the hard-coded string lint validation rules.

Related Problems and Solutions