NoSuchMethodError: android.adservices.customaudience.CustomAudienceManager.<init>(android.content.Context) after updating Facebook SDK to 18.0.X
Checklist before submitting a bug report
- [x] I've updated to the latest released version of the SDK
- [x] I've searched for existing Github issues
- [x] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [x] I've read the Code of Conduct
- [x] This issue is not security related and can safely be disclosed publicly on GitHub
Java version
21
Android version
Not related
Android SDK version
18.0.X
Installation platform & version
Gradle (Android Gradle plugin 8.7.3)
Package
Core & AppEvents
Goals
- Successfully run UI snapshot tests using Paparazzi after upgrading the Facebook Android SDK from 17.0.0 to 18.0.X.
Expected results
- The SDK should not invoke CustomAudienceManager when running in a JVM-only environment like Paparazzi.
Actual results
- The Facebook SDK attempts to instantiate CustomAudienceManager even when running in a JVM-based test environment, causing NoSuchMethodError.
- This issue did not occur in v17.0.0, but appeared after upgrading to v18.0.X.
Steps to reproduce
- Upgrade Facebook SDK from 17.0.0 to 18.0.X
- Run UI snapshot tests using Paparazzi
- Observe the following crash:
Cannot invoke "java.util.List.get(int)" because the return value of "com.android.ide.common.rendering.api.RenderSession.getRootViews()" is null java.lang.NullPointerException: Cannot invoke "java.util.List.get(int)" because the return value of "com.android.ide.common.rendering.api.RenderSession.getRootViews()" is null at app.cash.paparazzi.PaparazziSdk.takeSnapshots(PaparazziSdk.kt:245) at app.cash.paparazzi.PaparazziSdk.snapshot(PaparazziSdk.kt:178) at app.cash.paparazzi.PaparazziSdk.snapshot$default(PaparazziSdk.kt:176) at app.cash.paparazzi.PaparazziSdk.snapshot(PaparazziSdk.kt:173) at app.cash.paparazzi.Paparazzi.snapshot(Paparazzi.kt:103) at app.cash.paparazzi.Paparazzi.snapshot$default(Paparazzi.kt:100)
Code samples & details
// INSERT YOUR CODE HERE
@lonskiTomasz, it seems that version 18.0.3 fixed the issue.