lottie-react-native: expo app crashes at start on android

Description

android app crashes at start

Steps to Reproduce

create app using expo expo init my-new-project

add lottie expo install lottie-react-native

download this animation https://lottiefiles.com/16557-heart-pop

edit App.js like this

import React from 'react';
import {StyleSheet, View} from 'react-native';
import LottieView from "lottie-react-native";

export default function App() {
  return (
    <View style={styles.container}>
      <LottieView style={{width: 100, height: 100}} source={require('./assets/16557-heart-pop.json')}/>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

run app on android yarn android

Expected behavior: the app should work

Actual behavior: app crashes

Versions

npm version
{
  npm: '6.12.1',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '72',
  napi: '5',
  nghttp2: '1.39.2',
  node: '12.13.1',
  openssl: '1.1.1d',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.33.1',
  v8: '7.7.299.13-node.16',
  zlib: '1.2.11'
}

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~36.0.0",
    "lottie-react-native": "~2.6.1",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
    "react-native-web": "~0.11.7"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "babel-preset-expo": "~8.0.0"
  },
  "private": true
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 19
  • Comments: 15

Most upvoted comments

I am developer, I dont have any After Effects app. I downloaded lottie JSON from https://lottiefiles.com/ . How can I fix it? Is there any free convertor?

Fixed it for me 🎉

I solved it by using the old json format when exporting the animation with Bodymovin from After Effects.

  • In the Bodymovin window, click the Settings gear icon.
  • Scroll down and click Advanced.
  • Check Export old json format (for backwards compatibility).

image

Yeah, same issue Solved issue by decreasing version of lottie json file. In my old animation file the version was 5.5.4 and I could not start app on android device. Since I changed version to 4.5.7 the problem was gone. You can check version in json file after “v”: This would not work: {"v":"5.5.4","fr":29.9700012207031,"ip":0,"op":46.0000018736184, This would work: {"v":"4.5.7","fr":25,"ip":0,"op":33,"w":800,

Is there any other workaround? I don’t have After Effects to fix the issue 😕

I have the exact same problem

Having the same issue too… Anyone found a solution that doesn’t involve aftereffects?

have you found a fix?, i’m having the same problem

Is there any other workaround? I don’t have After Effects to fix the issue 😕

Try putting another Lottie in to check whether if you have done something wrong . Or check with your designer if he/she has used any effects in ae which is not supported by Lottie (I once got a flickering effect preset from ae which was not supported by lottie.) . If both of those doesn’t resolve your issue then your only option is to convert , or you could try online editors but can’t guarantee any success.

Decrease manually the version doesn’t work. It’s hard to find animations with compatibility but for me 5.4.2 works

expo 37 still using lottie v2, for new animations work need lottie version 3