PlayFab / PlayFabPartyUnity

38 stars 7 forks source link

Demo crashing on Android #37

Closed wtblife closed 9 months ago

wtblife commented 9 months ago

I haven't begun debugging, but using the most recent SDKs in Unity 2022.3.8 targeting Android 13 I haven't had any luck getting the demo to run. It crashes immediately on Android while running without issue on Windows.

Has anyone else had success or reproduced this issue?

nassosterz-ms commented 9 months ago

Hello,

Apologies you are facing this. Could you get the logs using adb functionality? I am getting them calling the following from a Command Prompt, prior to launching the Android application:

adb logcat E > \<path where your log file will be generated>log.txt

This would help us narrow down the issue.

wtblife commented 9 months ago

Here is the log: https://gist.github.com/wtblife/43456900fb17385d8488714ded4916d3

nassosterz-ms commented 9 months ago

Well one thing that stands out is this:

09-22 08:48:16.477 12848 12870 W Unity : If you are upgrading your SDK, you can ignore this warning as PlayFabSharedSettings will be imported soon. If you are not upgrading your SDK and you see this message, you should re-download the latest PlayFab source code.

The crash is not on the PlayFabParty code but on the PlayFab SDK code. Could you try updating the PlayFabSDK? This can be done from the Unity editor. The version shipped with PlayFab Party is almost a year old, and we expect customers to update the PlayFab SDK. Also, as this occurs during retrieving the titleId, make sure your titleId is configured correctly.

Let me know if this is relevant and resolves the issue.

wtblife commented 9 months ago

Unfortunately I'm not sure why that message is there since it's up to date and my title is set. I'm able to use the SDKs as expected on Windows. Seems like it's failing to find PlayFabSharedSettings in my Android build for some reason.

image

nassosterz-ms commented 9 months ago

Alright. I was testing the Android build a couple of months ago and I did not encounter this, let me see if I can repro it with this PlayFab SDK.

One thing to try is to check whether this directory: Assets/PlayFabSdk/Shared/Public/Resources/PlayFabSharedSettings.asset exists for you

wtblife commented 9 months ago

Yep Assets/PlayFabSDK/Shared/Public/Resources/PlayFabSharedSettings.asset exists and has the settings configured from the extension. I might try building on a different PC to see if it makes a difference cause it seems strange unless I'm missing some build settings.

        private static PlayFabSharedSettings GetSharedSettingsObjectPrivate()
        {
            var settingsList = Resources.LoadAll<PlayFabSharedSettings>("PlayFabSharedSettings");
            if (settingsList.Length != 1)
            {
                Debug.LogWarning("The number of PlayFabSharedSettings objects should be 1: " + settingsList.Length);
                Debug.LogWarning("If you are upgrading your SDK, you can ignore this warning as PlayFabSharedSettings will be imported soon. If you are not upgrading your SDK and you see this message, you should re-download the latest PlayFab source code.");
            }
            return settingsList[0];
        }
wtblife commented 9 months ago

I seem to have gotten it working now after disabling binary split and minify. I just ended up with this error following that:

09-22 19:26:27.598  6229  6316 E AndroidRuntime: FATAL EXCEPTION: Thread-5
09-22 19:26:27.598  6229  6316 E AndroidRuntime: Process: com.Taymes.Monstrategy, PID: 6229
09-22 19:26:27.598  6229  6316 E AndroidRuntime: java.lang.ExceptionInInitializerError
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:211)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:944)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at com.microsoft.xplatcppsdk_internal.HttpRequest.<clinit>(HttpRequest.java:29)
09-22 19:26:27.598  6229  6316 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 34
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported(AndroidPlatform.kt:370)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:204)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:178)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    at okhttp3.internal.platform.Platform.<clinit>(Platform.kt:179)
09-22 19:26:27.598  6229  6316 E AndroidRuntime:    ... 3 more

Which was resolved by updating the dependency to com.squareup.okhttp3:okhttp:4.11.0

nassosterz-ms commented 9 months ago

Great to hear you have resolve these issues. Honestly, I was not aware of what is happenning when binary split and minify are enabled, will keep it in mind to learn more about it.

Are you able now to use the plugin? Have you tried creating and joining a network?

Also, out of curiosity, are you planning on using Voice Chat?

wtblife commented 9 months ago

I have no plans to use voice chat currently, but everything is running as expected now (joining network, sending/receiving data, etc)

nassosterz-ms commented 9 months ago

That is awesome. In that case, unless there is something else needed from us, you can close this issue. I am sure it will prove helpful to someone in the future, thus, really appreciate that you documented what you faced and how you resolve the issues!