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!!

Recent Posts:

Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.