HttpClient does not work correctly with android 5.0

Hi,
I am developing my game using cocos2d-x 3.2.
While I’m adapting my game to android 5.0, I encountered a problem related to cocos HttpClient.
With android 5.0, HttpClient’s send method causes block then application is halt.
(With android 4.4.2, it works correctly)

To simplify this problem, I implemented sample code as below.

・AppDelegate.cpp

bool AppDelegate::applicationDidFinishLaunching() {
    network::HttpRequest *request = new network::HttpRequest();
    request->setUrl("http://www.cocos2d-x.org/");
    request->setRequestType(network::HttpRequest::Type::GET);
    request->setResponseCallback([this](network::HttpClient *sender, network::HttpResponse *response) {
        CCLOG("ResponseCallback called.");
    });
    network::HttpClient::getInstance()->send(request);
    request->release();
    return true;
}

However, Response callback set by setResponseCallback() is never called.
As far as I investigate, in HttpClient.cpp, curl_easy_perform method in perform(long *responseCode) causes blocking and never return.

・HttpClient.cpp

/// @param responseCode Null not allowed
bool perform(long *responseCode)
{
    if (CURLE_OK != curl_easy_perform(_curl))
        return false;
    CURLcode code = curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, responseCode);
    if (code != CURLE_OK || !(*responseCode >= 200 && *responseCode < 300)) {
        CCLOGERROR("Curl curl_easy_getinfo failed: %s", curl_easy_strerror(code));
        return false;
  }
  // Get some mor data.

  return true;
}

Could anyone take a look at them and see if you could give me an advice on this situation?

Tested environment is as below.
Device: Both Nexus5(Android-L) and Simulator(Android5.0)
Cocos2dx Version: Both 3.2 and 3.3rc0
NDK Version: r9d

Our apps also having this issues!

HttpClient doesn’t work at all on Nexus 5 running L developer preview.

I’ve tested it on 4.4 Nexus 7 and everything works well.
No crash or halt happens it just doesn’t do anything.

I have not resolved the posted problem yet.
To make the problem easier to investigate for everyone, I uploaded a sample project to GitHub.
The project does not work correctly with Nexus5 running L developer preview.

Project’s url is as below.

Could anyone take a look at them and see if you could give me an advice on this situation?

My project also have this issue.
Nexus7 wifi 2013, Lollipop os, not preview.

Experience the same issue. No clue about how to debug it. It seem libcurl is integrated by prebuilt. No way to add log to investigate.

Any clue, guys?

HttpClient process stoped here -> ‘CURLE_OK != curl_easy_perform(_curl)’
curl_easy_perform function return any value.

It seems that it is a bug caused by curl.
We will take a look of it.
I have created a issue of it: https://github.com/cocos2d/cocos2d-x/issues/9138.

The same issue.Eager for help!

Hi, Guys. I’m sorry my english skill.
I have a new Information.
Today, I upgrade my NDK ver. r10 to r10c, and testing my app for VideoPlayer.
I saw my app work with Http connection, but I don’t know why my app http connection work;;
The problem fixed NDK r10c? I would like to know your test results.

add) also update curl last version

Testing By Mac Eclipse Luna.
Build Target Android 4.4.2.
Test Device : Nexus 7 Wifi 2013 Android 5.0
NDK : x86_64 r10c