码迷,mamicode.com
首页 > 移动开发 > 详细

自己编写库模块,Win&Android联调总结二

时间:2014-07-29 16:13:39      阅读:450      评论:0      收藏:0      [点我收藏+]

标签:android   des   style   http   color   os   文件   数据   

 

libGameNet模块Win&Android联调总结二

作者:JackJCracker) 邮箱:jcracker@163.com

作者很赖还是不想上传图片 需要图片和配置实例的来这里下载:下载

 

Application.mk 废弃不用 因为这里是打包成库 

Android.mk:

#LOCAL_PATH := $(call my-dir)

LOCAL_PATH := E:\ylss\project\NewStartDemo\NetworkDemo\NetworkDemo

 

include $(CLEAR_VARS)

 

$(call import-add-path,$(LOCAL_PATH)/cocos2d)

$(call import-add-path,$(LOCAL_PATH)/cocos2d/external)

$(call import-add-path,$(LOCAL_PATH)/cocos2d/cocos)

 

#TARGET_CPU_ABI := armeabi

#TARGET_CPU_ABI := armeabi-v7a

#TARGET_CPU_ABI := armeabi-v7a-hard

#TARGET_CPU_ABI := armeabi

 

#设置c++11头文件路径和链接路径

#prebuilt_stdcxx_PATH := E:\android-ndk-r9d-windows-x86_64\android-ndk-r9d\sources\cxx-stl\gnu-libstdc++\4.8

 

#LOCAL_C_INCLUDES += \

$(prebuilt_stdcxx_PATH)/include \

    $(prebuilt_stdcxx_PATH)/libs/$(TARGET_CPU_ABI)/include

 

#LOCAL_LDFLAGS += -L$(prebuilt_stdcxx_PATH)/libs/$(TARGET_CPU_ABI) -lgnustl_static -lsupc++

    

LOCAL_MODULE := gamenet_static

 

LOCAL_MODULE_FILENAME := libgamenet

 

AL_CPP_EXTENSION := .cpp

 

LOCAL_SRC_FILES := $(LOCAL_PATH)/libGameNet/Classes/JackInetAdress.cpp \

                   $(LOCAL_PATH)/libGameNet/Classes/JackNetDelegate.cpp\

$(LOCAL_PATH)/libGameNet/Classes/JackSocket.cpp

 

LOCAL_C_INCLUDES := $(LOCAL_PATH)/libGameNet/Classes

 

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

 

# 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

LOCAL_WHOLE_STATIC_LIBRARIES += protobuf_static

 

LOCAL_STATIC_LIBRARIES := lib_game_net

   

include $(BUILD_STATIC_LIBRARY)

 

$(call import-module,.)

$(call import-module,audio/android)

 

# $(call import-module,Box2D)

# $(call import-module,editor-support/cocosbuilder)

# $(call import-module,editor-support/spine)

# $(call import-module,editor-support/cocostudio)

# $(call import-module,network)

# $(call import-module,extensions)

$(call import-module,external/protobuf-2.5.0)

 

 

Android.mk:

LOCAL_PATH := $(call my-dir)

 

include $(CLEAR_VARS)

 

 

TARGET_CPU_ABI := armeabi

#TARGET_CPU_ABI := armeabi-v7a

#TARGET_CPU_ABI := armeabi-v7a-hard

#TARGET_CPU_ABI := armeabi

 

#设置c++11头文件路径和链接路径

prebuilt_stdcxx_PATH := E:\android-ndk-r9d-windows-x86_64\android-ndk-r9d\sources\cxx-stl\gnu-libstdc++\4.8

 

LOCAL_C_INCLUDES += \

$(prebuilt_stdcxx_PATH)/include \

    $(prebuilt_stdcxx_PATH)/libs/$(TARGET_CPU_ABI)/include

LOCAL_C_INCLUDES += E:\ylss\project\NewStartDemo\NetworkDemo\NetworkDemo\cocos2d\external\protobuf-2.5.0\src

 

$(warning $(prebuilt_stdcxx_PATH))

#LOCAL_LDFLAGS += -L$(prebuilt_stdcxx_PATH)/libs/$(TARGET_CPU_ABI) -lgnustl_static -lsupc++

LOCAL_STATIC_LIBRARIES += -L$(prebuilt_stdcxx_PATH)/libs/$(TARGET_CPU_ABI) -lgnustl_static -lsupc++

LOCAL_MODULE := protobuf_static

 

LOCAL_MODULE_FILENAME := libprotobuf

 

LOCAL_CPP_EXTENSION := .cc

 

LOCAL_SRC_FILES := \

src/google/protobuf/io/coded_stream.cc\

src/google/protobuf/stubs/common.cc \

src/google/protobuf/descriptor.cc \

src/google/protobuf/descriptor.pb.cc\

src/google/protobuf/descriptor_database.cc\

src/google/protobuf/dynamic_message.cc\

src/google/protobuf/extension_set.cc\

src/google/protobuf/extension_set_heavy.cc\

src/google/protobuf/generated_message_reflection.cc \

src/google/protobuf/generated_message_util.cc \

src/google/protobuf/io/gzip_stream.cc \

src/google/protobuf/compiler/importer.cc\

src/google/protobuf/message.cc\

src/google/protobuf/message_lite.cc \

src/google/protobuf/stubs/once.cc \

src/google/protobuf/compiler/parser.cc\

src/google/protobuf/io/printer.cc \

src/google/protobuf/reflection_ops.cc \

src/google/protobuf/repeated_field.cc \

src/google/protobuf/service.cc\

src/google/protobuf/stubs/structurally_valid.cc \

src/google/protobuf/stubs/strutil.cc\

src/google/protobuf/stubs/substitute.cc \

src/google/protobuf/stubs/stringprintf.cc \

src/google/protobuf/text_format.cc\

src/google/protobuf/io/tokenizer.cc \

src/google/protobuf/unknown_field_set.cc\

src/google/protobuf/wire_format.cc\

src/google/protobuf/wire_format_lite.cc \

src/google/protobuf/io/zero_copy_stream.cc\

src/google/protobuf/io/zero_copy_stream_impl.cc \

src/google/protobuf/io/zero_copy_stream_impl_lite.cc

 

#LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/protobuf

 

#LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/protobuf

#LOCAL_CFLAGS := -std=c99

#LOCAL_CFLAGS += -std=c++11 -stdlib=libstdc++ -Wno-error=c++11-narrowing

 

include $(BUILD_STATIC_LIBRARY)

a) 支持配置完成

b) 导入eclipse 解决eclipse中的错误

 

编译导出apk

开启adb

 

 

生成了apk

 

但是这里我们不用elicpse调试。因为它调试native不方便

我选用vs2012+visual gdb来调试 这样可以设置断点之类的。

 

c) Vs2012 + visual gdb联调

打开win32平台的networkDemo,设置一个断点。然后如下图操作

 

 

 

 

开启服务端

 

 

调试apk

 

 

最好按我建议的选项勾选,不然gdb很容易死掉

 

等待启动gdb 注意屏幕是否提示安装

 

启动完成。手机上出现屏幕。点击按钮触发设置的断点

 

成功卡住。 查看服务端

 

成功建立连接。

 

手机发送数据 服务端信息

 

服务端成功接收到数据。 同时服务端返回有数据。

查看客户端断点处

 

成功卡住返回的数据

d) Win&&Android联调完毕


自己编写库模块,Win&Android联调总结二,布布扣,bubuko.com

自己编写库模块,Win&Android联调总结二

标签:android   des   style   http   color   os   文件   数据   

原文地址:http://my.oschina.net/wpracker/blog/295737

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!