cocos2d-x3.2在mac os下制作编译.so提示ui错误:
用cocos compile -p android编译提示错误。
jni/../../Classes/GameMenuScene.cpp:53: error: undefined reference to 'cocos2d::ui::Button::create(std::string const&,std::string const&,cocos2d::ui::Widget::TextureResType)'
jni/../../Classes/GameMenuScene.cpp:56: error: undefined reference to 'cocos2d::ui::Button::setTitleText(std::string const&)'
jni/../../Classes/GameMenuScene.cpp:58: error: undefined reference to 'cocos2d::ui::Widget::addTouchEventListener(std::function<void (cocos2d::Ref*,cocos2d::ui::Widget::TouchEventType)>)'
解决办法:
在ecplise中找到jni下找到android.mk,打开它,把LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static和LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static前面的#除掉,保存,再进行编译一般就ok了,再不行就把$(call import-module,editor-support/cocostudio)和Box2d,或是用到了网络通信,则除掉相应的前面的#号。放出来进行编译。
# LOCAL_WHOLE_STATIC_LIBRARIES += Box2d_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
# LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,.)
dio/android)
# $(call import-module,Box2D)
$(call import-module,editor-support/cocostudio)