Skip to main content
Question

RevenueCat Paywall Component Causing Crash on Android - NoSuchMethodError in AnimatedContent Method

  • 14 August 2024
  • 6 replies
  • 135 views

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:

  1. 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 sofferings, setOfferings] = useState(null);

  const nloading, 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;
 

  1. Run the app on an Android device.
  2. Navigate to the screen where the paywall is supposed to be displayed.
  3. 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

 

Same on flutter using purchases_flutter: ^7.0.2


I got eactly the same problem for android. Note that ios works fine.

Note that I am using "react-native-purchases-ui": "^8.0.0"


any updates on this? 


Hey. We are getting the same exact error with purchases_flutter: ^7.0.2

We are waiting for a fix to publish our android app. So, any luck ?


Hi everyone, thanks for reporting this issue! We were able to reproduce this issue in flutter and react native. It happens with the new multi-tier template. We just released version 8.1.0 for both platforms that should fix this issue.

Please check it out and let us know if you run into any more issues!


Hey. Working like charm now. Thank you. For everyone, you have to use version 8.1.0 for both  purchases_flutter and purchases_ui_flutter