question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

okhttp 3.8.0: ProGuard "can't find referenced class javax.annotation.Nullable"

See original GitHub issue

According to the 3.8.0 CHANGELOG: “We’ve added a compile-time dependency on the JSR 305 annotations. This is a provided dependency and does not need to be included in your build configuration…”

However, ProGuard brings a lot of messages like this:

okhttp3.Address: can't find referenced class javax.annotation.Nullable
…

This can be worked around by adding jsr305 to the gradle configuration:

    compile 'com.google.code.findbugs:jsr305:3.0.2'

However, according to the docs, this should be done by okhttp dependencies.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

11reactions
vanniktechcommented, May 14, 2017
10reactions
JakeWhartoncommented, Oct 26, 2017

That is not OkHttp’s package and so those rules are effectively useless (aside from dropping warnings in Okio and for JSR 305 annotations). Even if it was OkHttp’s correct package, you’re better off turning off ProGuard than doing such an overly-keepy rule.

On Thu, Oct 26, 2017 at 4:22 PM attaullahpro notifications@github.com wrote:

it looks like minifyEnabled is set to true in your build.gradle so it is applying proguard rules. so you should add this rules to your proguard-rules.pro file

-dontwarn okio.** -dontwarn com.squareup.okhttp3.** -keep class com.squareup.okhttp3.** { ; } -keep interface com.squareup.okhttp3.* { *; } -dontwarn javax.annotation.Nullable -dontwarn javax.annotation.ParametersAreNonnullByDefault

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/okhttp/issues/3355#issuecomment-339720798, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEdEAc1uIR4V-lOVyHFNstfmQCzsKks5swLG2gaJpZM4NaVjH .

Read more comments on GitHub >

github_iconTop Results From Across the Web

When I Generate signed APK, I got an issue - Stack Overflow
I have fix by adding below code in proguard. -dontwarn okio. ... -keep class com.squareup.okhttp3. ... Nullable -dontwarn javax.annotation.
Read more >
Proguard Can't Find Referenced Class - ADocLib
I have updated Retrofit v 2.3.0 and okhttp 3.8.0 and okio 1.13.0 but now OkHttpCall: can't find referenced class javax.annotation.concurrent.
Read more >
Troubleshooting ProGuard issues on Android - Medium
The OkHttp library added new annotations ( javax.annotation.Nullable ) to their classes in version 3.8.0. Because they use a compile-time ...
Read more >
3.x Change Log - OkHttp
Fix: Don't crash when running as a plugin in Android Studio Canary 4.1. To enable platform-specific TLS features OkHttp must detect whether it's...
Read more >
What does these errors mean and how do I resolve them?
Nullable. UATHelper: Packaging (Android (ETC1)): Warning: okhttp3.Address: can't find referenced class javax.annotation.Nullable.
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found