error: package android.support.v4.view does not exist

For newer versions of react-native support v4 is replaced with androidx ,Add this at end of your app level build.gradle If you had similar problem with other libraries you have to replace them like this

preBuild.doFirst { 
ant.replaceregexp(
    match:'import android.support.v4.view.', 
    replace:'import androidx.core.view.', 
    flags:'g', 
    byline:true
) { 
    fileset(
        dir: '../../node_modules/lottie-react-native/src/android/src/main/java/com/airbnb/android/react/lottie/', 
        includes: '*.java'
    ) 
} 

Note that this happens if you enable androidX , If you do not want it disable it in .properties file


Try doing this

npm i jetifier
npx jetify