openimsdk / openim-sdk-core

Instant Messaging
https://openim.io
Apache License 2.0
358 stars 320 forks source link

How to compile to Android SDK? #33

Closed metooweb closed 1 month ago

shoyu666 commented 2 years ago

1 编辑 Open-IM-SDK-Core/Makefile 添加 android 目标

android:
    go get golang.org/x/mobile
    rm -rf build/ open_im_sdk/t_friend_sdk.go open_im_sdk/t_group_sdk.go  open_im_sdk/ws_wrapper/
    go mod download golang.org/x/exp
    GOARCH=arm64 gomobile bind -v -trimpath -ldflags "-s -w"  -target=android ./open_im_sdk/ ./open_im_sdk_callback/

2 编译会生成2个文件: open_im_sdk-sources.jar,open_im_sdk.aar 3 在Open-IM-SDK-Android/blob/main/OpenIM-SDK/lib 放入 open_im_sdk.aar (lib是新建目录) 4 编辑 https://github.com/OpenIMSDK/Open-IM-SDK-Android/blob/main/OpenIM-SDK/build.gradle

1注释掉aar
//implementation 'io.openim:core-sdk:2.3.0@aar'
2使用新编译的aar (Open-IM-SDK-Android/blob/main/OpenIM-SDK/open_im_sdk.aar)
implementation files('libs/open_im_sdk.aar')  
shoyu666 commented 2 years ago

flutter 编辑:https://github.com/OpenIMSDK/Open-IM-SDK-Flutter/blob/main/android/build.gradle

BaiMoHan commented 1 year ago

flutter 编辑:https://github.com/OpenIMSDK/Open-IM-SDK-Flutter/blob/main/android/build.gradle

大佬,请问下这个集成到客户端后,如何让其go-sdk-core的日志在android studio的终端中也输出出来。我虽然在使用sdk的时候将日志等级设置了6,但是控制台没有输出其底层sdk打印的日志。可是我看到有其他人问问题的时候能贴出来底层sdk-core的go的日志,请问是否应该对android studio进行相关配置项的设置

kubbot commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

kubbot commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.