连接演示的 Photon 服务器在 Android studio 上执行错误

Photon Server connecting Demo perform error on Android studio

Hello, World.

我在 Photon 服务器上工作。 从 Photon 下载 SDK 后尝试 运行 一个演示文件。顺便说一句,有些意外。

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/demo.android.loadBalancing-GIL4HGl5AqJzcC3EdKzdFg==/base.apk"],nativeLibraryDirectories=[/data/app/demo.android.loadBalancing-GIL4HGl5AqJzcC3EdKzdFg==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "libdemoLoadBalancing.so"

我以为这个错误是由.so find not find引起的。但是 Photon 支持说这是错误的。他对我说我必须包含 .a 文件,而不是 .so 作为静态库。

下面是我的 Android.mk 文件。

# Generated by VisualGDB

LOCAL_PATH := $(call my-dir)
PHOTON_SDK_ROOT := $(LOCAL_PATH)/../../../..

include $(CLEAR_VARS)

LOCAL_MODULE := demoLoadBalancing
#VisualGDBAndroid: AutoUpdateSourcesInNextLine
LOCAL_SRC_FILES := ../../src/NetworkLogic.cpp AndroidNetworkLogic.cpp main.cpp

LOCAL_C_INCLUDES := $(PHOTON_SDK_ROOT) ../inc/ ../../shared/inc
LOCAL_CFLAGS := -Werror-implicit-function-declaration -Wall -DEG_DEBUGGER -D__STDINT_LIMITS -D_EG_ANDROID_PLATFORM
LOCAL_STATIC_LIBRARIES := loadbalancing-cpp-static-prebuilt photon-cpp-static-prebuilt common-cpp-static-prebuilt
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

$(call import-add-path, $(PHOTON_SDK_ROOT)/LoadBalancing-cpp/lib)

$(call import-module,loadbalancing-cpp-prebuilt)

它正在尝试连接 Android studio 上的 Photon 服务器,没有 PUN - 仅限 Unity SDK JAVA/Kotlin。 源代码在 https://github.com/Baymax-bibi/Android-photon-server-working.git

如果有人有 Photon Server connect 的经验,请分享给编码器。

我试图解决我发布的问题并遇到了 Photon 支持。他们在下面对我说。

Those errors indicate an incompatibility between the stdlib version that your app links against and the one that the Photon libs link against.

The SDK provides libs that have been built against the gcc version of the stdlib (libstdc++) and libs that have been built against the clang version of the stdlib (libc++). The former ones are used on default and the lattter ones have an additional 'libc++' postfix in their filenames.

It looks like your app links against the clang version of the stdlib and against those builds of Photon libs that link against the gcc version of the stdlib.

However your app and all 3rd party libs that your apps link to must agreed on using the same version of the stdlib as those 2 incompatible versions can't be mixed with each other.

Please see https://forum.photonengine.com/discussion/comment/42718/#Comment_42718 for instructions on how to link against the libc++ variants of the Photon libs.

Doing so should fix your errors.

看起来对我有用...)