Firestore:库中的包引用无效

Sam*_*ern 19 android lint gradle firebase google-cloud-firestore

更新到com.google.firebase:firebase-firestore:16.0.0I 后,我得到以下lint错误:

  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]
Run Code Online (Sandbox Code Playgroud)

似乎grpc依赖性lint令人不快.我怎么解决这个问题?

nic*_*ico 27

您可以通过在lint.xml文件中设置以下内容来删除此错误:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="InvalidPackage">
        <ignore path="*/io.grpc/grpc-core/*"/>
    </issue>
</lint>
Run Code Online (Sandbox Code Playgroud)

本lint.xml应该是在你的根应用模块.

将错误降级为警告的优点是,如果您以后碰巧添加了一个真正包含无效包的依赖项,您仍然会收到错误.


Sam*_*ern 12

这个错误应该是安全的忽略.您可以InvalidPackage使用此块将所有错误降级为警告:

android {

    // ...

    lintOptions {
        warning 'InvalidPackage'
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 为什么忽略它是安全的? (2认同)