Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lint error on Okio

I started getting this errors about

**InvalidPackage: Package not included in Android**

../../../../../../../.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.6.0/98476622f10715998eacf9240d6b479f12c66143/okio-1.6.0.jar: Invalid package reference in library; not included in **Android: java.nio.file**. Referenced from **okio.Okio**.

I am using:

  compile 'com.squareup.okhttp:okhttp:2.5.0'

I did some reading on the same at following links:

https://github.com/square/okio/issues/58

https://github.com/square/okhttp/issues/896

I have 2 questions for the same

Question 1 :: What change could have introduce this error ? The code was compiling Okay previously, I don't think upgrading Gradle to 2.10/2.11 or upgrading Android studio 2.0 beta 4/ AS 2.0 beta 5 could have introduced this error. As i tried to revert everything back. But i was still getting same error!

Question 2 :: I don't wish to disable lint or add following quote in my app. What is the best way to stop this error from happening?

lintOptions {
    warning 'InvalidPackage'
}
like image 922
Manisha Avatar asked Feb 18 '16 20:02

Manisha


2 Answers

You can disable the warning specifically for this error by creating a lint configuration file:

<lint>
    <issue id="InvalidPackage">
        <ignore regexp="okio-1.6.0.jar"/>
    </issue>
</lint>

And then apply that configuration in your build file:

android {
    ...

    lintOptions {
        lintConfig file("lint.xml")
    }

    ...
}
like image 142
kevinpelgrims Avatar answered Nov 11 '22 18:11

kevinpelgrims


You can try add this into build.gradle

android {
...

lintOptions {
    disable 'InvalidPackage'
}

...

}

like image 33
androidmalin Avatar answered Nov 11 '22 18:11

androidmalin