react-native run-android: BUILD FAILED
At the moment of run our React-Native projects on Android environment for development purpose, sometimes we can get some errors like the following one:
“Could not resolve all dependencies for configuration ‘:app:_debugApk”
Possibles causes and solution:
While developing we can going installing some libs/modules depending on our requirements, some of these could be unnecesary and next uninstalled through npm uninstall [-S] “the-lib-or-module” but the link of that lib/module could stay registered in the build.gradle file into the dependencies definition, this file is at the directory OurReactApp/android/app/build.gradle, remove them.
On the other hand, those libs/modules get registered into the MainApplication.java file located at OurReactApp/android/app/src/main/java/com/ourreactapp/MainApplication.java. Take a look to the imports at the begining and be sure that the libs/modules uninstalled are not included there, next check out the same into the getPackages() function.
So, if the react-native run-android command is firing you a BUILD FAILED error, be sure that an uninstalled lib/module is neither defined into the dependencies nor the Main Application declarations.