How can I use "extensions/network" in cocos2d-x 2.0.2 on android??


#1

Hi, All:

I have problems in using “CCHttpClient”, and I have some questions here: (All my question is on cocos2d-x 2.0.2 version.)

  1. Is there a problem on XCode project templates ?
    Because I can’t use CCHttpClient in my project without modify, to use this network extension I need to add something to my project. They are:
    add “libcurl.a” library.
    copy the “network” folder into my project.
    add “/libs/cocos2dx/platform/third_party/ios” into header search path.

Do you really design for this??
or you have miss some thing in XCode templates?

  1. How can I use “extensions/network” normally on android?
    I have tried the “testCpp/ExtensionsTest/NetworkTest”, and it works fine on my android devices.

But it does’t work on my project, I have did the follow things.
modify Android.mk
add : LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)

I can build the project without error, but I can’t receive response using CCHttpClient, seems it doesn’t work at all.

Please help me, thank you in advance.


#2

Any one can help me??


#3

Vincent Chou wrote:

Hi, All:
>
I have problems in using CCHttpClient, and I have some questions here: (All my question is on cocos2d-x 2.0.2 version.)
>
h2. 1) Is there a problem on XCode project templates ?
Because I can’t use CCHttpClient in my project without modify, to use this network extension I need to add something to my project. They are:
>
# add “libcurl.a” library.
# copy the “network” folder into my project.
# add “/libs/cocos2dx/platform/third_party/ios” into header search path.
>
Do you really design for this??
or you have miss some thing in XCode templates?

>
h2. 2) How can I use “extensions/network” normally on android?
I have tried the “testCpp/ExtensionsTest/NetworkTest”, and it works fine on my android devices.
>
But when I copy that code into my project, it does’t work, I have did the follow things.
modify Android.mk
# add : LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
# $(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
>
I can build the project without error, but I can’t receive response using CCHttpClient, seems it doesn’t work at all.
>
Please help me, thank you in advance.

on android ,you should add LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static to Android.mk , and you have to add permission to AndroidManifest.xml.