Reputation: 772
I have a list of elements in a RecyclerView, to make life easier I am using androidx.recyclerview:recyclerview:1.0.0
.
I am trying to load Ads from Facebook as described here https://developers.facebook.com/docs/audience-network/android (they are using com.android.support:recyclerview-v7:25.3.1
).
I have already added the support library recyclerview-v7
and support-v4
. But the FBAudienceNetwork still gives me this error:
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.RecyclerView"
...
Dependency not found: android.support.v4.content.LocalBroadcastManager
Dependency not found: android.support.v7.widget.RecyclerView
...
java.lang.RuntimeException: Facebook Audience Network SDK doesn't have all required classes. Please, check LogCat output for tag FBAudienceNetwork. See more: https://developers.facebook.com/docs/audience-network/android/ . You can change Integration Error mode by setting AdSettings.setIntegrationErrorMode()
Is there a way to "force" FBAudienceNetwork to use my androidx.recyclerview
instead of the com.android.support:recyclerview-v7
or is there a way these two can work together?
Upvotes: 0
Views: 576
Reputation: 54204
It seems that you are already aware, but just in case... This is happening because the Facebook SDK is dependent on the pre-androidx
version of RecyclerView
, and you are using the androidx
version in your app.
You could downgrade your own dependency, so that both your app and the Facebook SDK are using the version of RecyclerView
that lives in the android.support.v7.widget
package.
Or, you could use the Jetifier tool to dynamically re-write the Facebook SDK's dependency so that it uses the version of RecyclerView
that lives in the androidx.recyclerview.widget
package.
The easiest way to do the second option is to follow the steps listed on the Migrating to AndroidX document:
[...] set the following two flags to
true
in yourgradle.properties
file:android.useAndroidX=true android.enableJetifier=true
Upvotes: 1