时间:2021-07-01 10:21:17 帮助过:38人阅读
今天写一个网络框架,在vs上面很欢快的运行车,心想,玛!cocos2d-x 3.0这么方便,估计不久的将来我就能回家种地了,因为不用程序员了,直接cocos2dstudio拖界面了= =!!。 写好windows上的,这不想作一下,编译到android平台给同事看看,cocos run -p android
今天写一个网络框架,在vs上面很欢快的运行车,心想,尼玛!cocos2d-x 3.0这么方便,估计不久的将来我就能回家种地了,因为不用程序员了,直接cocos2dstudio拖界面了= =!!。
写好windows上的,这不想作一下,编译到android平台给同事看看,cocos run -p android,突然httpClient::getInstance undefined,知道那种妹子已经铺好床等你,但是你裤绳打结的心情吗!!!而且网上也没什么好的解决方案,最后自己捉摸捉摸,是因为httpclient没有编译,于是有如下android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp FILE_LIST := hellocpp/main.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) #编译network里面的httpClient.cpp和socketIo.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../../../cocos/network/*.cpp) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static #curl static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_curl_static #socket static LOCAL_WHOLE_STATIC_LIBRARIES += libwebsockets_static include $(BUILD_SHARED_LIBRARY) $(call import-module,2d) $(call import-module,audio/android) $(call import-module,Box2D) #添加network支持 $(call import-module,network) $(call import-module,../extensions) #添加curl库的支持 $(call import-module,curl/prebuilt/android) #添加websocket支持 $(call import-module,websockets/prebuilt/android)