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.

java.lang.NoSuchMethodError: No virtual method getHttpUrlChecked(Ljava/lang/String;)Lokhttp3/HttpUrl

See original GitHub issue

Hello, everyone.

I am developing an Ionic App (hence I don’t know much about Android).

Recently I am facing a problem since I installed two different cordova plugins which are:

When I install these two plugins and make a HTTP request, I get the following error:

java.lang.NoSuchMethodError: No virtual method getHttpUrlChecked(Ljava/lang/String;)Lokhttp3/HttpUrl; in class Lokhttp3/internal/Internal; or its super classes (declaration of 'okhttp3.internal.Internal' appears in /data/app/es.sanitas.hospitales.portalpaciente-1/base.apk)
        at okhttp3.internal.huc.OkHttpURLConnection.buildCall(OkHttpURLConnection.java:373)
        at okhttp3.internal.huc.OkHttpURLConnection.getResponse(OkHttpURLConnection.java:435)
        at okhttp3.internal.huc.OkHttpURLConnection.getResponseCode(OkHttpURLConnection.java:491)
        at okhttp3.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
        at okhttp3.internal.huc.OkHttpsURLConnection.getResponseCode(OkHttpsURLConnection.java:26)
        at com.github.kevinsawicki.http.HttpRequest.code(HttpRequest.java:1758)
        at com.synconset.cordovahttp.CordovaHttp.returnResponseObject(CordovaHttp.java:247)
        at com.synconset.cordovahttp.CordovaHttpGet.run(CordovaHttpGet.java:30)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:776)

In the second plugin I’ve read that it uses proguard and that it could cause some problems so I modified it as I read as follows (but the problem is not gone):

# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.**

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
   public *;
}

# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile

Could anyone please give me a hand with this?

I’ve been a couple days with this problem and cant find out how to fix it. Please, help.

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cgcmancommented, Nov 8, 2020

in my case, the problem was Firebase dependencies, i fix with this solution for every Firebase implementation.

implementation ('com.google.firebase:firebase-messaging:20.3.0'){
     exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
1reaction
swankjessecommented, Jun 17, 2020

@Keepertje make sure every OkHttp dependency is on the same OkHttp version. If you want you can use a platform dependency to make this easy:

dependencies {
   api(platform("com.squareup.okhttp3:okhttp-bom:4.7.2"))
   api("com.squareup.okhttp3:okhttp")              // No version!
   api("com.squareup.okhttp3:logging-interceptor") // No version!
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoSuchMethodError: No virtual method toString(Z ...
You're pulling in an old version of okhttp-urlconnection, and it is incompatible with the current version of the OkHttp core library.
Read more >
java.lang.NoSuchMethodError No virtual method log(ILjava ...
NoSuchMethodError : No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)V in class Lokhttp3/internal/platform/Platform; ...
Read more >
java.lang.NoSuchMethodError: No virtual method log(ILjava ...
java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)V in class Lokhttp3/internal/platform/Platform; ...
Read more >
No virtual method load(Ljava/lang/String;)Lcom/squareup ...
Hello, I am using picasso library (link) for my imageview in my customlistview and it is working great. I am also using in...
Read more >
OutSystems Community
java.lang.NoSuchMethodError: No virtual method getHttpUrlChecked(Ljava/lang/String;)Lokhttp3/HttpUrl; in class Lokhttp3/internal/Internal; ...
Read more >

github_iconTop Related Medium Post

No results found

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