[SOLVED] HttpURLConnection fail in android

Hey there,

I was trying to connect to a specific server through Cocos’ http request, which in android uses the Cocos2dxHttpURLConnection.

It works fine in a modern android device, but in an older one (v 2.3, to be precise) it is giving me the following warning in logcat:

dalvikvm: dvmFindClassByName rejecting 'org/cocos2dx/lib/Cocos2dxHttpURLConnection'

Do you know why could this be?

Thank for reading and for your help!

Solved. After reading this article, it was all a security issue.

Hello.
What did you do to solve this? I have the same problem and the link you provided doesn’t contains any useful solution for me.

If I build my application for linux, network works fine, but on my android device, it give me that logcat message.
The only difference is I’m developing in c++

Sorry to hear that, bud. I simply tried the first solution of that link (making sure the date and time were actually correct) and it worked.

Android blocks https connections whose certificates seem invalid or expired.

All I can suggest is you try these two things to determine the issue:

  1. Try an http connection (not https). If this also fails, try other apps or the web browser to make sure it’s not a network issue.
  2. Try you application in other devices to make sure your android device isn’t the culprit.

Chances are this error isn’t the engine’s fault but something external failing.

@crisoberillo Did you managed to solve it? I am receiving this “Cocos2dxHttpURLConnection” error too. Please kindly help

If I remember, it turned out that my problem was with the IP address I used.
Probably the first address was not reachable.

I’m not sure this was exactly the case, but the problem was not in the game code.

1 Like

@crisoberillo Thanks for your prompt reply!

I got this error when I tried to connect to Soket.IO server.
If you ever worked with Socket.IO before, and if you could help please help me again.

Continuing the discussion at Socket.IO Extention Update - 1.x working with 0.9.x backwards compat: