I've been working in the same React Native project for months and recently the Android build has started failing. To my knowledge I haven't changed anything about my development environment and I haven't updated or changed any packages or dependencies that the project uses.
Task :@react-native-community_async-storage:compileDebugJavaWithJavac FAILED
Task :@react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED
Task :@react-native-community_toolbar-android:compileDebugJavaWithJavac FAILED
Task :@sentry_react-native:compileDebugJavaWithJavac FAILED
Task :@react-native-community_netinfo:compileDebugJavaWithJavac FAILED
I've done all of the following that I found from other questions with a similar problem
- Synced the project with gradle files in android studio
- Ran
gradlew clean
in the android directory which does succeed, but the build still fails - Checked that
android.useAndroidX
andandroid.enableJetifier
in the gradle.properties file are both true - Checked that I have
implementation "com.facebook.react:react-native:+"
in my build.gradle file. I tried changing it from + to the actual version of react native that I'm using but it made no difference.
I'm not an expert mobile developer by any means so I'm hoping that I'm missing something obvious, but any help or suggestions would be greatly appreciated.