DEV Community

Gaurav Saini
Gaurav Saini

Posted on

React Native android build failure

Hey folks,
I'm struggling with building a react native project for android and need some help.
When I run the build command (./gradlew bundleRelease) from the <project_root>/android directory I get an error (as shown below) saying that I haven't accepted the licenses for the android SDK and I need to do so in order to build the project.


And when (after some googling) I ran the accept licenses command from the SDK root directory, I get another error (as shown below)


It might be worth pointing out that I'm essentially reviving a very old project that I had the source code for, so the Android Studio, Android SDK and everything else is freshly installed on my system.

Thanks in advance for all the help!

Discussion (4)

arung86 profile image
Arun Kumar G • Edited on

need to accept the android SDK license, as you told u have just installed Android SDK, you need to accept the license before you use, here is the link which describes the ways to solve

sainig profile image
Gaurav Saini Author • Edited on

Hi Arun,
I tried running the accept licenses command (the same command that is mentioned in the link you provided) already, but got another error as shown in the second screenshot in my post above
Here's the full exception when running the accept licenses command

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
    at java.base/java.lang.ClassLoader.loadClass(
    ... 5 more
arung86 profile image
Arun Kumar G

what if you try opening the sdk manager GUI and accept manually?

Thread Thread
sainig profile image
Gaurav Saini Author

Yes, I tried that, but that didn't work also. Fortunately I found the issue, I was looking in the wrong place, I had downloaded sdk version 30 from Android Studio, but the project was using sdk version 28.
I downloaded the SDK version 28 also and then it worked fine.