Okhttp: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found

Created on 9 Apr 2019  路  7Comments  路  Source: square/okhttp

Hi,

After searching google, Github issue etc..., I didn't find the answer to resolve this issue.
I found the #4322 and this is only because of the cache.

React Native: 59+
buildToolsVersion: 28.03
minSdkVersion: 16
compileSdkVersion: 28
targetSdkVersion: 28
Gradle: 3.3.1

  • This error comes wit ADB install signed apk package on a REAL device.
  • Debugging and release run in react native works without problem.

Error:
04-09 16:53:02.841 22070 22093 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules 04-09 16:53:02.841 22070 22093 E AndroidRuntime: Process: com.app_app, PID: 22070 04-09 16:53:02.841 22070 22093 E AndroidRuntime: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1333) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at okhttp3.HttpUrl.get(HttpUrl.java:916) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at okhttp3.Request$Builder.url(Request.java:165) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.modules.websocket.WebSocketModule.connect(WebSocketModule.java:93) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:789) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:98) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232) 04-09 16:53:02.841 22070 22093 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764) 04-09 16:53:02.856 22070 22075 I zygote64: Do partial code cache collection, code=236KB, data=142KB 04-09 16:53:02.857 17048 25342 W ActivityManager: Force finishing activity com.app_app/.MainActivity 04-09 16:53:02.857 22070 22075 I zygote64: After code cache collection, code=231KB, data=140KB 04-09 16:53:02.857 22070 22075 I zygote64: Increasing code cache capacity to 1024KB 04-09 16:53:02.863 17048 17163 I ActivityManager: Showing crash dialog for package com.app_app u0

bug

Most helpful comment

I have the same issue with the client's Huawei Honor 9 Lite LLD-L31 device, with installed application beta-version (signed app from the Google Play Store, beta test). It works fine for Android 6 and 7.1, MTK chipsets. But not for Huawei Honor 9 Lite LLD-L31 device. Unfortunately, I cannot provide a test source code here. Only next information from the Firebase Crashlytics:

FatalException: java.lang.IllegalArgumentException
Expected URL scheme 'http' or 'https' but no colon was found
okhttp3.HttpUrl$Builder.parse (HttpUrl.java:1332)
okhttp3.HttpUrl.get (HttpUrl.java:917)
retrofit2.Retrofit$Builder.baseUrl (Retrofit.java:458)

I checked all URLs in app and they are correct. Hope it will help, at least a bit. I'll try to downgrade libraries I use and find a version that will work, and then will update this info.

UPDATE:
OkHttp has been used from the Retrofit library. After Retrofit downgrade to the 2.4.0 version issue has not been found. So seems error into Retrofit or OkHttp. Will duplication it for Retrofit too [https://github.com/square/retrofit/issues/3077])

All 7 comments

Executable test case?

Executable test case?

Yes, in simulator and react-native run-android this work. After sign the apk and starting the app doing same things. The error will show up.

Sounds like a bug in React Native. Please report there. Or provide an executable test case here without the React Native dependency.

I have the same issue with the client's Huawei Honor 9 Lite LLD-L31 device, with installed application beta-version (signed app from the Google Play Store, beta test). It works fine for Android 6 and 7.1, MTK chipsets. But not for Huawei Honor 9 Lite LLD-L31 device. Unfortunately, I cannot provide a test source code here. Only next information from the Firebase Crashlytics:

FatalException: java.lang.IllegalArgumentException
Expected URL scheme 'http' or 'https' but no colon was found
okhttp3.HttpUrl$Builder.parse (HttpUrl.java:1332)
okhttp3.HttpUrl.get (HttpUrl.java:917)
retrofit2.Retrofit$Builder.baseUrl (Retrofit.java:458)

I checked all URLs in app and they are correct. Hope it will help, at least a bit. I'll try to downgrade libraries I use and find a version that will work, and then will update this info.

UPDATE:
OkHttp has been used from the Retrofit library. After Retrofit downgrade to the 2.4.0 version issue has not been found. So seems error into Retrofit or OkHttp. Will duplication it for Retrofit too [https://github.com/square/retrofit/issues/3077])

Unclear what action to take here. If you can provide an executable test case that reproduces the problem, please open a new issue.

Issue closed without any solution. Great!

@d-rahul provide a reproduction, or logging showing the urls are valid and we can investigate. This bug report is not reproducible as is.

Generally for user support like this, we would advise using stackoverflow. This github issue tracker is for confirmed bug reports.

Was this page helpful?
0 / 5 - 0 ratings