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

Android Build Crashes on Start: Didn't find class "com.facebook.FacebookContentProvider"

Discussion in 'Android' started by darrensmith, Oct 11, 2017.

  1. darrensmith

    darrensmith

    Joined:
    Apr 13, 2017
    Posts:
    16
    Using Unity 2017.1.2f1, I built my app for Android. Build completed successfully. I used "Build & Run", which loaded it onto the Android device I have attached to my PC via USB.

    When the app starts on my Android device, it says, "Unfortunately, Bingo has stopped."

    Looking at the logcat, I see this:

    E/AndroidRuntime(24085): FATAL EXCEPTION: main
    E/AndroidRuntime(24085): Process: com.darrensmith.net.bingo, PID: 24085
    E/AndroidRuntime(24085): java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.darrensmith.net.bingo-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.darrensmith.net.bingo-2, /vendor/lib, /system/lib]]
    E/AndroidRuntime(24085): at android.app.ActivityThread.installProvider(ActivityThread.java:5121)
    E/AndroidRuntime(24085): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4713)
    E/AndroidRuntime(24085): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4596)
    E/AndroidRuntime(24085): at android.app.ActivityThread.access$1600(ActivityThread.java:169)
    E/AndroidRuntime(24085): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
    E/AndroidRuntime(24085): at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime(24085): at android.os.Looper.loop(Looper.java:146)
    E/AndroidRuntime(24085): at android.app.ActivityThread.main(ActivityThread.java:5487)
    E/AndroidRuntime(24085): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(24085): at java.lang.reflect.Method.invoke(Method.java:515)
    E/AndroidRuntime(24085): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    E/AndroidRuntime(24085): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    E/AndroidRuntime(24085): at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime(24085): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.darrensmith.net.bingo-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.darrensmith.net.bingo-2, /vendor/lib, /system/lib]]
    E/AndroidRuntime(24085): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
    E/AndroidRuntime(24085): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    E/AndroidRuntime(24085): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    E/AndroidRuntime(24085): at android.app.ActivityThread.installProvider(ActivityThread.java:5106)
    E/AndroidRuntime(24085): ... 12 more

    What could cause the class com.facebook.FacebookContentProvider to not be found?

    This app builds & runs successfully in iOS and Windows.
     
    Last edited: Oct 11, 2017
  2. jedswi

    jedswi

    Joined:
    May 23, 2018
    Posts:
    4
    Hey, I got this same error. I'm using Unity 5.6.6 on a scene which includes no facebook activity, and I marked the fb plugin folders to be excluded from the build with ~
     
  3. darrensmith

    darrensmith

    Joined:
    Apr 13, 2017
    Posts:
    16
    I'm sorry I don't recall what I did to get it to eventually build. advice: Update Unity & Facebook to latest versions and try again. Make sure you have the Facebook settings correct in Unity. Select Facebook->Edit Settings from the toolbar, and check that everything there is correct.
     
  4. jedswi

    jedswi

    Joined:
    May 23, 2018
    Posts:
    4
    Thanks for the reply man, unfortunately I'm on a large project where I can't upgrade Unity, and actually don't have access to the FB developer settings. I'm guessing a setting is messed up
     
  5. unity_91BnGyqxSYUPdQ

    unity_91BnGyqxSYUPdQ

    Joined:
    Aug 7, 2018
    Posts:
    25
    Hello Guys,

    I am facing the same issue currently Im on Unity version - 2017.4.27f1 and I'm currently upgraded to Facebook version 7.18.0 and getting the same issue any one know how to fix the same.




    Looking forward to getting so inputs from you all on how to fix this.
     
  6. Bryarey

    Bryarey

    Joined:
    Aug 24, 2014
    Posts:
    25
    Same on Unity 2019.2.3f1 / fb SDK 7.18.0
     
  7. ndmrzk

    ndmrzk

    Joined:
    Jul 25, 2018
    Posts:
    35
    Same here too. Unity 2019.3.0f3, version 7.18.0. My issue on github.
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    Try exporting Android Studio project and using that same class in Java code. If it's available there, look into Proguard settings.
     
  9. ndmrzk

    ndmrzk

    Joined:
    Jul 25, 2018
    Posts:
    35
    c1pr1an likes this.
  10. c1pr1an

    c1pr1an

    Joined:
    Jul 4, 2014
    Posts:
    6
    Thank you! I had the same issue and this helped
     
  11. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    I hate SO MUCH facebook.
    Every time facebook give problem.
    anyone have solved?
     
  12. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,859
    FacebookContentProvider is part of core facebook libraries. Once check if EMDU( Aka Jar Resolver) resolved all of your libraries successfully. If not,
    1. Delete Assets/External Dependency Manager folder
    2. Try downloading the latest copy from here.
     
  13. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    A
    Thanks, i tried but i did non solved...


    At the end I just added the fb sdk on the project and it worked correctly...
    I do not understand why admob mediation for facebook did not downloaded the right stuff...
     
  14. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,859
    In that case it looks like FB SDK's dependency xml is not properly imported earlier.
    Anyways, glad its working now!
     
  15. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    I think is not that beacuse it appens on 3 projects and i reimported the fb sdk FOUR TIME each time on each project.
     
  16. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,859
    Oh ok! Strange!
     
  17. white_sparrow

    white_sparrow

    Joined:
    Jan 15, 2020
    Posts:
    1
    For everyone like me comes here because they can't install the app on their devices after deleting the Facebook SDK. Even after deleting the Facebook SDK, some lines about it remain in the Manifest.xml file. The root of the problem is there. I deleted everything related to Facebook and after restarting the project, everything went ok.
     
    Last edited: Sep 21, 2022
    Eatton, ysftulek and WaqasGameDev like this.