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.

1-android-build-error

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

2-accept-licenses-error

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!

Top comments (4)

Collapse
 
arung86 profile image

@sainig
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
thetopsites.net/article/52247017.s...

Collapse
 
sainig profile image
Gaurav Saini • Edited

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
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 5 more
Collapse
 
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

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.
Thanks