Android : Accidental Octal Lint Warning


Android Lint tool used to check Android Project codes for potential bugs and provides suggestions to optimize your code. This tool helps to improve correctness, security, performance, usability, accessibility, and internationalization.

If you using Android Studio or Android ADT for Eclipse or any other IDE for Android, you will find that when you compile your project the IDE automatically runs the Lint programs and provides warnings, errors and other information related to your code.

If you get an Error: Accidental Octal then it is because you are using Groovy and an integer literal that starts with a leading 0 that is being interpreted as an octal number. You get this error because this may be an accident addition of 0 which can lead to subtle bugs, for example when used in the versionCode of an app.

If you want to suppress this Error message to a warning or an info type,

  1. Go to Android Studio Welcome Screen.
  2. Click on Configure
  3. Project Defaults
  4. Settings
  5. Select Inspections
  6. Search for Accidental Octal
  7. Now under Option Change Severity to Info instead of Error
  8. Apply changes and we are done!!