'Lottie working on an Emulator But not on real Device

I have lottie library in my project built on react-native. followed These installation steps on an android, but to my surprise the animation works on fine on emulator but not on the real device.

I created a js file named MyLottie.js and have the following code

import React, {useState} from 'react';
import Modal from 'react-native-modal';

import LottieView from 'lottie-react-native';

const MyLottie = ({...props}) => {
  return (
    <Modal
      backdropOpacity={0.0}
      animationType={'slide'}
      transparent={true}
      isVisible={props.isvisible}>
      <LottieView
        autoSize={false}
        // style={{width: 100, height: 100}}
        source={require('./LottieFiles/paperplane.json')}
        loop={true}
        autoPlay={true}
      />
    </Modal>
  );
};

export default MyLottie;

and then used MyLottie.js on another screen like this, a code snippet:

... //some other code snippets here
return(
<View>
... //some other code snippets here
 <MyLottie isvisible={loading} />
</View>
)

using npx react-native run-android --variant=release command, this works fine on emulator and the lottie animation is okay but when I use that command on real device, and app is installed. lottie doesn't animate at all. just dormant. what is wrong here? additionally, on the terminal there are some warning deprecations and so on, including warnings regarding lottie, is this affecting? if it is affecting why it is working fine on emulatorbut not real device. Here is the warnings.

Gradle detected a problem with the following location: 'D:\myproject\lottieproj'. Reason: Task ':app:bundleReleaseJsAndAssets' uses this output of task ':lottie-react-native:writeReleaseAarMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

as the above mentions,

This can lead to incorrect results being produced, depending on what order the tasks are executed

if that is the case, is it possible to lead an incorrect result only to real device but not on an emulator

How can I solve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source