I'm encountering a crash on Android when trying to display the RevenueCat paywall component in my React Native app. The same component works fine on iOS, but on Android, the app crashes with the following error:
java.lang.NoSuchMethodError: No static method AnimatedContent(Ljava/lang/Object;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Ljava/lang/String;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V in class Landroidx/compose/animation/AnimatedContentKt; or its super classes
Steps to Reproduce:
- Implement the RevenueCat paywall component in the app.
import React, { useEffect, useState } from 'react';
import { View, ActivityIndicator, Text } from 'react-native';
import Purchases from 'react-native-purchases';
import RevenueCatUI from 'react-native-purchases-ui';
const PayWallScreen = ({ navigation, route, setLoading }) => {
const [offerings, setOfferings] = useState(null);
const [loading, setLoadingState] = useState(true);
useEffect(() => {
navigation.setOptions({ headerShown: true });
const fetchOfferings = async () => {
try {
const fetchedOfferings = await Purchases.getOfferings();
if (fetchedOfferings.current !== null) {
setOfferings(fetchedOfferings.current);
} else {
console.log("No offerings found");
}
} catch (e) {
console.error("Error fetching offerings:", e);
} finally {
setLoadingState(false);
setLoading(false);
}
};
fetchOfferings();
}, []);
if (loading) {
return <ActivityIndicator size="large" color="#0000ff" />;
}
return (
<View style={{ flex: 1 }}>
{offerings ? (
<RevenueCatUI.Paywall />
) : (
<View>
<Text>No offerings available</Text>
</View>
)}
</View>
);
};
export default PayWallScreen;
- Run the app on an Android device.
- Navigate to the screen where the paywall is supposed to be displayed.
- The app crashes as soon as the paywall
<RevenueCatUI.Paywall />
is rendered.
What I Have Tried:
- Added the necessary ProGuard rules for Jetpack Compose and RevenueCat as recommended in the documentation.
- Verified that the RevenueCat SDK is correctly configured and later offering shows on console log.
- Cleaned and rebuilt the project multiple times.
Additional Notes:
I've searched the community and StackOverflow for similar issues, but the solutions provided (e.g., adding ProGuard rules, avoiding modals) have not resolved the issue.
I would appreciate any insights or suggestions on how to fix this crash.
SDK and Versions:
- React Native: 0.74.0
-
"react-native-purchases": "^8.0.1",
"react-native-purchases-ui": "^8.0.0",
- Android Studio: Dolphin | 2021.3.1 Patch 2
- Android Device: Pixel 4a, running Android 12