Facebook SDK problem with Unity 4.x, when building for Android

I know, Unity 4.x old, but I’m just trying to get rid of an old project by releasing it for Android without having to go through quite a hassle in upgrading the project to Unity 5. So, the problem is that when running the game on Android it instantly crashes due to this:

E/AndroidRuntime( 5614): Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.facebook.FacebookContentProvider” on path: /data/app/myapk.apk
E/AndroidRuntime( 5614): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 5614): at android.app.ActivityThread.installProvider(ActivityThread.java:4969)
E/AndroidRuntime( 5614): … 12 more

If I go to the Plugins/Android/AndroidManifest.xml and comment out this:

<provider android:name=“com.facebook.FacebookContentProvider”

The game does run, but then (perhaps unsurprisingly) if trying to use the Facebook integration, it crashes.

Any idea, what’s wrong? I’ve tried to clean old stuff from potential earlier Facebook SDK’s, but I still get this issue. The Facebook SDK is old too (6.2.2.) but it’s the last one that supports Unity 4.

On Facebook developer discussions there was the assumption that an error like this would be caused by Unity 4 not supporting .aar files, but the Facebook SDK 6.2.2. (nor my project otherwise) doesn’t have any .aar files, so that shouldn’t be the issue.

So any ideas how to fix this?

Ok, I got it working. It was just a matter of recreating the manifest.

Hi Jeff, I’m using Unity 4 too for publishing my game and can’t upgrade to Unity 5; does Facebook 6.2.2 SDK still works correctly nowdays? Thanks for help!

@twiggyash I can confirm that FB 6.2.2 works fine with Unity 4.7.2 - we have an app live on iOS/Android with that version. App uses Facebook Sign In / sharing.

Hi! I haven’t touched that project in quite a long while, but yeah, the Facebook integration in the game still seems to work. In this thread my problem was just about getting the Android build to work, and for that the problem was about recreating the manifest.

Thank you very much! I’ll try to use it. Have a nice day!

Sorry Jefferson but we are with the same problem. What you mean with (recreating the manifest)? We can’t upgrade the project for the Unity 5. Can you help us?

We are using the last version of Facebook SDK 7.9

<?xml version="1.0" encoding="utf-8"?>

Can you get the email from user in this version? Thx