Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Has anyone gotten Facebook sdk for Unity to run on Android recently??

Discussion in 'Editor & General Support' started by deltron1830, Sep 25, 2020.

  1. deltron1830

    deltron1830

    Joined:
    Mar 20, 2013
    Posts:
    27
    Full details here...
    https://stackoverflow.com/questions...class-com-facebook-facebookcontentprovider-an

    How to replicate this error...

    * Create a new Unity project.
    * Import the facebook sdk unitypackage
    * Set your App Id for facebook via Facebook\Edit Settings
    * Using Assets\External dependency manager\Android, press 'Resolve dependencies', then press 'delete resolved libraries' (otherwise the build will fail at the gradle stage)
    * Build and run.
    * When the app tries to run I immediately get the error message on my phone 'app has stopped working'
    and see this error in the logs ...

    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk"],nativeLibraryDirectories=[/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/lib/arm64, /data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]

    Suggested fixes I've tried [from here][1]
    1. I've tried different combinations of old or new facebook sdks and old or new versions of Unity.
    2. I've tried building from a few different machines to different Android devices.
    3. I've deleted the external dependency manager included with the facebook sdk and used [this one][2] instead. In order to get this one to resolve I had to set a 'Custom Gradle Properties Template'in the player setting under publishing settings.
    4. I've set a Custom Proguard file'in the player setting under publishing settings, and I added the following two lines to the file..

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

    So I've tried all the suggested fixes and various combinations thereof. I dont know what more I can do. Can anyone suggest anything else to try?


    [1]: https://github.com/facebook/facebook-sdk-for-unity/issues/393
    [2]: https://github.com/googlesamples/unity-jar-resolver
     
  2. deltron1830

    deltron1830

    Joined:
    Mar 20, 2013
    Posts:
    27
    I found a solution.. I posted it as answer to SO question
     
  3. alaskry2002

    alaskry2002

    Joined:
    Aug 22, 2020
    Posts:
    1
    link please