android – Firestore: Invalid package reference in library-ThrowExceptions

Exception or error:

After updating to com.google.firebase:firebase-firestore:16.0.0 I get the following lint error:

  Error: Invalid package reference in library; not included in Android: javax.naming.directory. Referenced from io.grpc.internal.DnsNameResolver.JndiResolver. [InvalidPackage]
  Error: Invalid package reference in library; not included in Android: javax.naming. Referenced from io.grpc.internal.DnsNameResolver.JndiResolver. [InvalidPackage]

Seems that the grpc dependency is making lint unhappy. How can I solve this?

How to solve:

You can remove this error by setting the following content in a lint.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="InvalidPackage">
        <ignore path="*/io.grpc/grpc-core/*"/>
    </issue>
</lint>

The lint.xml should be at the root of your application module.

The advantage over demoting the error to a warning is that if you later happen to add a dependency which really have an invalid package, you will still get the error.

###

This error should be safe to ignore. You can downgrade all InvalidPackage errors to warnings using this block:

android {

    // ...

    lintOptions {
        warning 'InvalidPackage'
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *