• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

React Native Android build failing with 'compileDebugJavaWithJavac' on several packages

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 :mad:react-native-community_async-storage:compileDebugJavaWithJavac FAILED

Task :mad:react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED

Task :mad:react-native-community_toolbar-android:compileDebugJavaWithJavac FAILED

Task :mad:sentry_react-native:compileDebugJavaWithJavac FAILED

Task :mad: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 and android.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.
 
There are a few other things you can try if you are still having issues with the build failing:

  1. Try running react-native run-android from the command line to see if there are any additional error messages that can help identify the issue.

  2. Make sure that you have the latest version of the Android SDK and build tools installed. You can check for updates in the Android Studio SDK Manager.

  3. Make sure that you have the correct version of the Android Support Repository and Google Repository dependencies installed. You can check for updates in the Android Studio SDK Manager.

  4. Try deleting the node_modules directory and running npm install or yarn install again to make sure all of your dependencies are up to date.

  5. If you have recently updated any dependencies or libraries, it is possible that there may be compatibility issues. You can try downgrading to a previous version of the dependency to see if that resolves the issue.

  6. If none of the above steps help, you can try cleaning the project by going to "Build > Clean Project" in Android Studio.
It is also a good idea to check the React Native documentation and the documentation for any libraries you are using to see if there are any known issues or breaking changes that may be causing the build to fail.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones