AppLovin / AppLovin-MAX-Unreal

16 stars 5 forks source link

Crash on SDK initialize #4

Closed supermicut closed 2 years ago

supermicut commented 2 years ago

This might sound like a noob question, but: are there any dependencies that need to be taken into account when initializing the SDK ?

I have a project, blueprints only. The project is live on google play, without any other issues.

I'm using UE 4.27.1, AppLovin plugin 1.0.1.

With the demo project provided (no other plugins enabled) I have the same issue, no errors when building, just crash on SDK Initialize.

Thanks

thomasmso commented 2 years ago

Hi - do you have the crash's stack trace and exception message?

supermicut commented 2 years ago

Hi Thomas,

I think this should be what you need.

2022-02-23 10:36:25.059 6220-6220/? A/DEBUG: 2022-02-23 10:36:25.059 6220-6220/? A/DEBUG: Build fingerprint: 'samsung/a5y17ltexx/a5y17lte:8.0.0/R16NW/A520FXXUGCTKA:user/release-keys' 2022-02-23 10:36:25.059 6220-6220/? A/DEBUG: Revision: '8' 2022-02-23 10:36:25.059 6220-6220/? A/DEBUG: ABI: 'arm64' 2022-02-23 10:36:25.059 6220-6220/? A/DEBUG: pid: 5966, tid: 6107, name: GameThread >>> com.AlexandruSimion.PassionGym <<< 2022-02-23 10:36:25.060 6220-6220/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: Abort message: 'java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: java_class == null' 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x0 0000000000000000 x1 00000000000017db x2 0000000000000006 x3 0000000000000008 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0080808080808080 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x8 0000000000000083 x9 0ca739dbd08bec58 x10 0000000000000000 x11 0000000000000001 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x12 ffffffffffffffff x13 0000000000000008 x14 ffffffffffffffff x15 002f972d741c0fc6 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x16 00000071dd0a72f8 x17 00000071dd048408 x18 00000071ab00c8f0 x19 000000000000174e 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x20 00000000000017db x21 00000071ab112940 x22 0000000000000002 x23 0000000000000e52 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x24 0000000000000061 x25 00000071a62c8000 x26 0000000000000e51 x27 00000071bb70e2a0 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: x28 0000000000000059 x29 00000071bb70e140 x30 00000071dcffabd4 2022-02-23 10:36:25.082 6220-6220/? A/DEBUG: sp 00000071bb70e100 pc 00000071dd048410 pstate 0000000060000000 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: backtrace: 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #00 pc 000000000006b410 /system/lib64/libc.so (tgkill+8) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #01 pc 000000000001dbd0 /system/lib64/libc.so (abort+88) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #02 pc 00000000004376dc /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+528) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #03 pc 0000000000437dec /system/lib64/libart.so (_ZN3art7Runtime7AborterEPKc+24) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #04 pc 0000000000522a3c /system/lib64/libart.so (_ZN7android4base10LogMessageD1Ev+900) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #05 pc 00000000002d5b80 /system/lib64/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+1716) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #06 pc 00000000002d5e4c /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+176) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #07 pc 0000000000319348 /system/lib64/libart.so (_ZN3art3JNI11GetMethodIDEP7_JNIEnvP7jclassPKcS6+1380) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #08 pc 0000000005a634fc /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (ZN27FJavaAndroidMaxUnrealPlugin10InitializeERK7FStringS2+108) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #09 pc 0000000005a654c4 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN12UAppLovinMAX10InitializeERK7FString+44) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #10 pc 0000000005a6dce8 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN12UAppLovinMAX14execInitializeEP7UObjectR6FFramePv+112) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #11 pc 0000000006951564 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN7UObject15ProcessInternalEPS_R6FFramePv+324) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #12 pc 0000000006804aac /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN9UFunction6InvokeEP7UObjectR6FFramePv+124) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #13 pc 000000000695284c /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN7UObject12ProcessEventEP9UFunctionPv+580) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #14 pc 0000000008a29738 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN20FLatentActionManager25TickLatentActionForObjectEfR9TMultiMapIiP20FPendingLatentAction20FDefaultSetAllocator27TDefaultMapHashableKeyFuncsIiS2_Lb1EEEP7UObject+964) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #15 pc 0000000008a28edc /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN20FLatentActionManager20ProcessLatentActionsEP7UObjectf+1312) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #16 pc 0000000008a3d914 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN6UWorld4TickE10ELevelTickf+2704) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #17 pc 00000000089089ec /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN11UGameEngine4TickEfb+768) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #18 pc 00000000057c43b8 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_ZN11FEngineLoop4TickEv+4928) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #19 pc 00000000057c2510 /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (_Z11AndroidMainP11android_app+3208) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #20 pc 00000000057c5bec /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) (android_main+148) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #21 pc 00000000057dd7fc /data/app/com.AlexandruSimion.PassionGym-vB9XEmjsZ278Gch3QIX6zA==/lib/arm64/libUE4.so (offset 0x57b5000) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #22 pc 0000000000067d04 /system/lib64/libc.so (_ZL15__pthread_startPv+200) 2022-02-23 10:36:25.157 6220-6220/? A/DEBUG: #23 pc 000000000001f348 /system/lib64/libc.so (__start_thread+68) 2022-02-23 10:36:25.393 4609-4609/? E/adbd: recv: OPEN 00000446 00000000 0009:74 63 70 3A 36 36 36 36 00 2022-02-23 10:36:25.393 4609-4609/? E/adbd: service_to_fd: tcp:6666

thomasmso commented 2 years ago

Thank you. We'll investigate when we have bandwidth - in the meantime it might be more efficient to debug on your end as well. Note that our plugin is already open source.

supermicut commented 2 years ago

Tried a lot of ideas the past few days ... and none worked for me. :-( Still ... I think I have made some progress. While reading the Verbose, I think I managed somehow to restrict the possible cause: W/System.err: java.lang.ClassNotFoundException: Didn't find class "com/epicgames/ue4/GameActivity$MaxUnrealPluginListener" on path: DexPathList[[zip file "......

Unfortunately, I really don't have the skills to fix this, or even to fully understand it :-)

PizzaPie144 commented 2 years ago

Getting exactly the same, any fix for this?

supermicut commented 2 years ago

Getting exactly the same, any fix for this?

None form my side. I had to look for another provider.

ritamsarmah commented 2 years ago

Sorry about the delay—we're currently looking into this. For context, the MaxUnrealPluginListener is a helper class for Android defined in AppLovinMAX_UPL_Android.xml under the gameActivityClassAdditions tag, and is expected to be available as a result of that (the UPL file itself gets registered in AppLovinMAX.Build.cs). My hunch is it could be related to the configuration in those.

While we work on the issue, my initial suggestion for debugging in your own projects would be to remove the conditional guard tags around lines that require bEnabled to be true in AppLovinMAX_UPL_Android.xml to see if the necessary additions then get included for your project.

PizzaPie144 commented 2 years ago

So after changing the function FJavaAndroidMaxUnrealPlugin::Initialize in AndroidJavaMaxUnrealPlugin.cpp to

`void FJavaAndroidMaxUnrealPlugin::Initialize(const FString &PluginVersion, const FString &SdkKey) { JNIEnv *JEnv = FAndroidApplication::GetJavaEnv(true);

jobject activityObj = FAndroidApplication::GetGameActivityThis();

jclass activityCls = FAndroidApplication::FindJavaClass("com/epicgames/ue4/GameActivity");

jmethodID ListenerGeneratorID = JEnv->GetMethodID(activityCls, "GetNewMaxUnrealListener", "()Ljava/lang/Object;");

jobject LocalListener1 = JEnv->CallObjectMethod(activityObj, ListenerGeneratorID);

auto LocalListener = NewScopedJavaObject<jobject>(JEnv, LocalListener1);

CallMethod<void>(InitializeMethod, *GetJString(PluginVersion), *GetJString(SdkKey), *LocalListener);

}`

And in the Android_UPL file inside gameActivityClassAdditions

` public class MaxUnrealPluginListener implements MaxUnrealPlugin.EventListener { public native void forwardEvent(String name, String params);

      public MaxUnrealPluginListener() {}

      @Override
      public void onReceivedEvent(String name, String params)
      {
      forwardEvent(name, params);
      }
      }

      public  Object GetNewMaxUnrealListener(){
      MaxUnrealPluginListener listener = new MaxUnrealPluginListener();
      return listener;
      }
    `

Seems to work, not sure if any other bug is introduced though at this point. Anyway couldn't get it to recognize the MaxUnrealEventListener nor the EventListener classes which seemed to be the problem in the first place.

ritamsarmah commented 2 years ago

@PizzaPie144, thanks for sharing your findings. I haven't been able to replicate the issue in our demo app or a clean blueprint project, so it's been a bit difficult to verify a solution on my end.

Could you try updating the <proguardAdditions> in AppLovinMAX_UPL_Android.xml with the line shown below and letting me know if that works?

  <proguardAdditions>
    <if condition="bEnabled">
      <true>
        <insert>
-keep public class com.epicgames.ue4.GameActivity$MaxUnrealPluginListener { *; }
        </insert>
      </true>
    </if>
  </proguardAdditions>