20. An error shows on my app – Execution failed for task ':lottie-react-native:compileDebugJavaWithJavac'
This error may arise after updating to a newer version of React Native and running the app on an Android device for the first time. Sometimes, just cleaning the builds
folder fixes this problem, but there are two other approaches that may fix it if cleaning didn't do the trick:
- Migrate your app to AndroidX by adding
android.useAndroidX=true
andandroid.enableJetifier=true
to yourgradle.properties
file and runningnpx jetifier
immediately afterward. This prepares your app to include the AndroidX-based libraries. - Make sure you are using JDK v8 instead of a newer version (Android Studio may install newer versions). You can follow the environment setup instructions on the React Native website (https://reactnative.dev/docs/environment-setup) and configure that version of Java as your default one in your shell configuration file.