Sayo Komolafe
Sayo Komolafe

Reputation: 1008

FAILURE: Build failed with an exception. ReactNative

Trying to build my android project using

react-native run-android

But, I keep getting this same error:

Warning: License for package Android SDK Platform 26 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK 
components:
[Android SDK Platform 26, Android SDK Build-Tools 26.0.2].
Before building your project, you need to accept the license agreements and 
complete the installation of the missing components using the Android Studio 
SDK Manager.
Alternatively, to learn how to transfer the license agreements from one 
workstation to another, go to http://d.android.com/r/studio-ui/export- 
licenses.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- 
debug option to get more log output.

BUILD FAILED

What I have tried:

  1. I tried using sdkmanager --licenses to accept all licenses
  2. I updated my SDK
  3. I cleaned my project using git clean -d -fx
  4. I made sure to have the latest Android SDK installed

How do I fix this?

Upvotes: 1

Views: 587

Answers (1)

Tung Duong
Tung Duong

Reputation: 1166

I suggest you build this React-native app by Android Studio.

Use Android Studio open Android project in folder /android of your project.

After project open Android Studio will suggest "update", need skip. With dialog for download SDK, you accept and continue.

When finish setup you can build your RN Android by menu Build\Build APK or direct run app by menu Run\Run App enter image description here enter image description here

Upvotes: 1

Related Questions