Unity facebook sdk'没有找到类“com.facebook.FacebookContentProvider"'对此还有什么建议吗? [英] Unity facebook sdk 'Didn't find class "com.facebook.FacebookContentProvider"' any more suggestions for this?

查看:84
本文介绍了Unity facebook sdk'没有找到类“com.facebook.FacebookContentProvider"'对此还有什么建议吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何复制此错误...

  • 创建一个新的 Unity 项目.

  • Create a new Unity project.

导入 facebook sdk unitypackage

Import the facebook sdk unitypackage

通过 Facebook\Edit Settings 为 Facebook 设置您的应用 ID

Set your App Id for facebook via Facebook\Edit Settings

使用 Assets\External dependency manager\Android,按Resolve dependencies",然后按删除已解决的库"(否则构建将在 gradle 阶段失败)

Using Assets\External dependency manager\Android, press 'Resolve dependencies', then press 'delete resolved libraries' (otherwise the build will fail at the gradle stage)

构建并运行.

当应用程序尝试运行时,我立即在手机上收到错误消息应用程序已停止工作"并在日志中看到此错误...

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]]

我已经尝试过从这里

  1. 我尝试过旧版或新版 facebook sdks 以及旧版或新版 Unity 的不同组合.

  1. I've tried different combinations of old or new facebook sdks and old or new versions of Unity.

我尝试从几台不同的机器构建到不同的 Android 设备.

I've tried building from a few different machines to different Android devices.

我删除了 facebook sdk 中包含的外部依赖管理器,并使用了 this一个代替.为了解决这个问题,我必须在发布设置下的播放器设置中设置一个自定义 Gradle 属性模板".

I've deleted the external dependency manager included with the facebook sdk and used this one 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.

我在发布设置下的播放器设置中设置了一个自定义 Proguard 文件,并将以下两行添加到文件中..

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?

推荐答案

好的,这是我在它起作用的地方遵循的一种特定方法.

Ok heres one specific method I followed where it worked.

  • Unity 版本:2019.3.15f1

  • Unity version: 2019.3.15f1

Facebook SDK 版本:7.21.2

Facebook SDK version: 7.21.2

使用 PlayServicesResolver、Resolve 库

Using the PlayServicesResolver, Resolve libraries

不要删除已解决的库

在发布设置下的播放器设置中设置一个Custom Proguard文件,并在文件中添加以下两行..

Set a Custom Proguard file in the player setting under publishing settings, and add the following two lines to the file..

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

  • 从 mainTemplate.gradle 中注释掉这些行

  • Comment out these lines from mainTemplate.gradle

         com.android.support:appcompat-v7
         com.android.support:support-v4
         com.android.support:customtabs
    

  • 所以你的 mainTemplate.gradle 看起来像这样...

    So your mainTemplate.gradle will look something like this...

        `// Android Resolver Repos End
        apply plugin: 'com.android.library'
    
        dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' 
        // Android Resolver Dependencies Start
            //implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
            //implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
            //implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    
            implementation 'com.facebook.android:audience-network-sdk:6.0.0' // Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:8
            implementation 'com.facebook.android:facebook-applinks:[7.1.0, 8)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
            implementation 'com.facebook.android:facebook-share:[7.1.0, 8)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
            implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
            implementation 'com.facebook.android:facebook-gamingservices:[7.1.0, 8)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:9
            implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
            implementation 'com.facebook.android:facebook-core:[7.1.0, 8)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
            implementation 'com.facebook.android:facebook-login:[7.1.0, 8)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
            implementation 'com.google.android.gms:play-services-ads:19.4.0' // Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:8
            implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17
            implementation 'com.google.android.gms:play-services-basement:17.2.1' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25
        // Android Resolver Dependencies End
        **DEPS**}`
    

    这篇关于Unity facebook sdk'没有找到类“com.facebook.FacebookContentProvider"'对此还有什么建议吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆