Android Lint Warnings Configuring lint checking in Java and XML source files

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

You can disable Lint checking from your Java and XML source files.

Configuring lint checking in Java

To disable Lint checking specifically for a Java class or method in your Android project, add the @SuppressLint annotation to that Java code.

Example:

@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

To disable checking for all Lint issues:

@SuppressLint("all")

Configuring lint checking in XML

You can use the tools:ignore attribute to disable Lint checking for specific sections of your XML files.

For example:

tools:ignore="NewApi,StringFormatInvalid"

To suppress checking for all Lint issues in the XML element, use

tools:ignore="all"


Got any Android Question?