0

I am using Unity 2018.1.6f1 and facebook-unity-sdk-7.13.0. When I try to build the project using gradle, the build is completed successfully but it gives an error while calling FB.Init()

"AndroidJavaException: java.lang.ClassNotFoundException: com.facebook.unity.FB".

I tried the solution in the following links: Android ProGuard settings for Facebook

I even checked whether I was using debug keyhash, which I was, but I addded release key hash and still getting the same error.

Any help would be appreciated.

P.S. It works fine in debug build

1 Answers1

-1

On Android publishing settings section (in the place you set the keystore stuff), there is a checkbox for User ProGuard file (at least if you are on Gradle). If you check it, Unity will make such file and put it in the project.

Then, on the proguard file, I added:

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

And that seems to be all! Then I see the FB SDK initing properly both on Debug and Release:

Hope it works for you as well.

Amg91
  • 165
  • 8
  • 25
ash a
  • 11