Burak
Burak

Reputation: 3

Unity Facebook SDK Error: AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='setIsUnityInit'

This error appears on our analytics console when we try our android builds.

AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='setIsUnityInit' signature='(Z)V' in class Ljava.lang.Object; java.lang.NoSuchMethodError: no static method with name='setIsUnityInit' signature='(Z)V' in class Ljava.lang.Object; com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:165) com.unity3d.player.UnityPlayer.nativeRender(Native Method) com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0) com.unity3d.player.UnityPlayer$F$a.handleMessage(Unknown Source:122) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loopOnce(Looper.java:226) android.os.Looper.loop(Looper.java:313) com.unity3d.player.UnityPlayer$F.run(Unknown Source:24) UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jclass, System.String methodName, System.String signature, System.Boolean isStatic) (at <00000000000000000000000000000000>:0) UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0) Facebook.Unity.CodelessUIInteractEvent.SetLoggerInitAndroid () (at <00000000000000000000000000000000>:0) UnityEngine.GameObject.AddComponent[T] () (at <00000000000000000000000000000000>:0) Facebook.Unity.FB.Init (Facebook.Unity.InitDelegate onInitComplete, Facebook.Unity.HideUnityDelegate onHideUnity, System.String authResponse) (at <00000000000000000000000000000000>:0) UnityEngine.GameObject:AddComponent() Facebook.Unity.FB:Init(InitDelegate, HideUnityDelegate, String)

We had fixed another error: AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='SetUserAgentSuffix' by adding -keep class com.facebook.unity.* {*;} to our proguard file. However java.lang.NoSuchMethodError: no static method with name='setIsUnityInit' error still coming.

our proguard file:

-keep class com.google.unity.** {
*;
}
-keep public class com.google.android.gms.ads.{
public *;
}
-keep public class com.google.ads.{
public ;
}
-keepattributes Annotation
-dontobfuscate
-keep class com.gameanalytics.sdk { ; }
-keep class com.gameanalytics.sdk. { *; }

-keep class com.gameanalytics.sdk.GAPlatform { ; }
-keep class com.gameanalytics.sdk.GAPlatform.* { ; }
-keep class android.net.ConnectivityManager.* { ; }
-keep class com.google.android.instantapps.InstantApps { ; }
-keepclassmembers class com.google.android.instantapps.InstantApps{; }
-keep class com.facebook.unity. {*;}

unity version: 2022.3.15 sdk version: 16.0.2

any tip or advice, thank you.

Upvotes: 0

Views: 276

Answers (1)

Michael Zhao
Michael Zhao

Reputation: 1

add these 2 lines in your proguard file: (works for me)

-keep class com.facebook.unity.** {;}

-keep class com.facebook.** {;}

Upvotes: 0

Related Questions