facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
Why app crash after building to Android?
Hello. I am using Unity 2019.3.0f3, Windows10, version 7.18.0.
I created a project that successfully built and run. Then i exported it as a package and imported it into another project that uses EasyAR camera function. I created a new app in the console so i got a new ID and entered the package name as per the new project. Updated the app id in unity facebook settings like attached images 3 and 4. but when building to my Samsung s10 it crashes with errors : Didnt get provider and didnt find class com.facebook.FacebookContentProvider like attached images 1 and 2. The AndroidManifest is as image 5. the generated hash key for android i did like this from the previous project, so its still the same. Please help.
I also added -keep class com.facebook.internal.* {*;}
and -keep class com.facebook.* {*;}
in proguard-user.txt file (as suggested in this closed issue ) which was created when i checkmarked user proguard file at Player Settings > Publishing Settings > Build : User Proguard File.
But i still got the same error as above.
I also did (from this Stackoverflow question) :
run "/Assets/Play Service Resolver/Android Resolver/Delete Resolved Libraries"
run "/Assets/Play Service Resolver/Android Resolver/Resolve"
Still got the error
Okay, so what i did was delete the PlayServicesResolver in Assets. Then I imported play-services-resolver-1.2.135.0.unitypackage which can be downloaded here : https://github.com/googlesamples/unity-jar-resolver
then Assets > Play Services Proivider > Android Resolver > Resolve
I tried all the steps u mentioned but still m getting the same error with app crash on start .
Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/mnt/asec/com.delusion.ludofun-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.a.b-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5387)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4958)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4898)
at android.app.ActivityThread.access$1500(ActivityThread.java:182)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1535)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5706)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1033)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/mnt/asec/com.a.b-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.a.b-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.ActivityThread.installProvider(ActivityThread.java:5372)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4958)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4898)
at android.app.ActivityThread.access$1500(ActivityThread.java:182)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1535)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5706)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1033)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)
Suppressed: java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I tried all the steps u mentioned but still m getting the same error with app crash on start .
Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/mnt/asec/com.delusion.ludofun-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.a.b-1/lib/arm, /vendor/lib, /system/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5387) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4958) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4898) at android.app.ActivityThread.access$1500(ActivityThread.java:182) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1535) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5706) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1033) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/mnt/asec/com.a.b-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.a.b-1/lib/arm, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.ActivityThread.installProvider(ActivityThread.java:5372) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4958) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4898) at android.app.ActivityThread.access$1500(ActivityThread.java:182) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1535) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5706) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1033) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) Suppressed: java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 13 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
hi. what version are you using? Try delete the fbsdk in Assets and import the latest version 7.19.1 or the same version you are using and start from the beginning. For me the Play Service Resolver was what helped.
I had this same issue with 7.21.1 and can confirm that replacing the PlayServiceResolver with the one here: https://github.com/googlesamples/unity-jar-resolver as suggested by aidanikuz02 solved it for me. It seems that the resolver provided with the sdk fails to function properly and doesn't really seem to do anything but still reports a success.
Still having this same problem with version 8.1.1. Workaround suggested by aidanikuz02 still seems to solve the issue but I'm wondering if there's an actual fix in progress?
I had this same issue with 7.21.1 and can confirm that replacing the PlayServiceResolver with the one here: https://github.com/googlesamples/unity-jar-resolver as suggested by aidanikuz02 solved it for me. It seems that the resolver provided with the sdk fails to function properly and doesn't really seem to do anything but still reports a success.
Schabbs solution worked like a charm for me. Thanks to Schabbs.