Build failure: React Native Android - react-native

I am setting up my environment to start developing react native apps. I keep getting the following error:
PS C:\map\development\learnreact\react-native\helloworld> react-native
run-android Starting JS server... Building and installing the app on
the device (cd android && gradlew.bat installDebug)...
Configure project :app Observed package id 'platform-tools' in inconsistent location
'C:\Users\bheka\AppData\Local\Android\Sdk\platform-tools' (Expected
'C:\Users\bheka\AppData\Local\Android\Sdk\platform-tools\platform-tools')
Checking the license for package Android SDK Build-Tools 27.0.3 in
C:\Users\bheka\AppData\Local\Android\Sdk\platform-tools\licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not
accepted. Checking the license for package Android SDK Platform 26 in
C:\Users\bheka\AppData\Local\Android\Sdk\platform-tools\licenses
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'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-26 Android SDK Platform 26
build-tools;27.0.3 Android SDK Build-Tools 27.0.3 To build this project, accept the SDK license agreements and install the missing
components using the Android Studio SDK Manager. Alternatively, to
transfer the license agreements from one workstation to another, see
http://d.android.com/r/studio-ui/export-licenses.html Using Android
SDK: C:\Users\bheka\AppData\Local\Android\Sdk\platform-tools
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2s Could not install the app on the device, read the
error above for details. Make sure you have an Android emulator
running or a device connected and have set up your Android development
environment:
https://facebook.github.io/react-native/docs/getting-started.html
I have accepted licenses using .\sdkmanager --licenses but no luck. I have reinstalled the sdk using the sdk manager in android studio with no luck. Anyone know what I should do?

Make sure the sdkbuildtools used by Android Studio and your emulator are the same as the ones in your build.gradle file in your project folder. If they do not match then either change the build.gradle file to use the installed sdk version. What probably happened is you have sdk 27 used by your android studio and your rn project tried to build it using sdk 26. Accepting the license will not change anything because while it's accepted it is still not used by your emulator and you Android Studio.
Hope that helps!

I had similar issue and was resolved by fixing environment variable, ANDROID_SDK_ROOT. It was previously pointing to .../sdk/platform-tools/ and later worked by changing it to .../sdk

Related

difficulty in phone setup with android studio

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;30.0.2 Android SDK Build-Tools 30.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /Users/harshit/Library/Android/sdk
Are you using Android Studio? if so try to install it from the Preferences > Appearance & Behavior > System Settings > Android SDK > Install Licensing Library and any other libraries that you are missing.

Error in USB debugging live testing in React Native

I am new to React Native and I install React Native and I want to test using y device (Realme 2).
Using USB debugging, but I am stuck on this same mobile using Android Studio runs in ADB.
This stucks at this position I await multiple 15m
info Starting JS server...
info Installing the app...
Configure project :app
File C:\Users\Muhammed Sajid Ali.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 28 in D:\sajid\AndroidSdk\licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
<======-------> 50% CONFIGURING [15m 0s]
:app
I solved this.
I earlier installed the Android SDK 8, 7.4.4, and 9 versions, but my mobile was 8.1. That’s why
it didn't start and it was downloading SDK 8.1. As I saw in the Android SDK folder, there was a new folder with some files.
Then I downloaded the 8.1 SDK, and it ran perfectly.
I think that was no problem with your compiler behavior, but I can suggest you to check if installing the app from USB is permitted in your phone's developer option and try to trigger the compiler with pressing return key (or enter) on the command line. That was working on mine.

I can't run react-native project on android simulator

A problem occurred configuring project ':app'.
failed to find Build Tools revision 23.0.1
Open the Android SDK Manager (on Mac start a new shell and run
android); in the window that appears make sure you check:
Android SDK Build-tools version 23.0.1
Android 6.0 (API 23)
Local Maven repository for Support Libraries (this is called Android Support Repository in older versions)
Click "Install Packages"

React Native make android app load in genymotion

I am trying to build an android app in react native. I have followed the official guidelines and downloaded genymotion and created a new project in react native. How do I open my project in genymotion?
I am getting the following error in my terminal
FAILURE: Build failed with an exception.
Where:
Build file '/Users/adamkatz/Projects/testAndroid/android/app/build.gradle' line: 69
What went wrong:
A problem occurred evaluating project ':app'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.504 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
when i added the following
export ANDROID_HOME=/usr/local/opt/android-sdk
i get the following error message
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
failed to find Build Tools revision 23.0.1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.735 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
You must define ANDROID_HOME I copied the relevant parts from the React Native setup guide below and link below that.
On Mac, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses:
If you installed the SDK via Homebrew, otherwise ~/Library/Android/sdk
export ANDROID_HOME=/usr/local/opt/android-sdk
On Linux, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses:
export ANDROID_HOME=<path_where_you_unpacked_android_sdk>
On Windows, go to Control Panel -> System and Security -> System -> Change settings -> Advanced -> Environment variables -> New
https://facebook.github.io/react-native/docs/android-setup.html#define-the-android-home-environment-variable
Add a properties file called local.properties in your android project directory (e.g. open your project named as xyz and add this file) and add:
sdk.dir=C\:\\Users\\jeey\\AppData\\Local\\Android\\Sdk
in the file and save it.
Re-run your project.
It seems you have no build tool version 23.0.1 installed in your pc. Lunch your sdk manager and install the specified version.
For more detail.
Go through setting up React native to use with Genny motion here
Android Setup - React Native

Titanium Studio Installation - Not able to run Hello World program in Android EMULATOR

Not able to run my first application disappointing!
I have installed the required software from Titanium studio. Software installed are
JAVA JDK, NODE.JS, Android SDK,.. and the rest of Titanium tools.
After Android SDK installation successful.I tried creating a sample Hello world application and tried running in Android Emulator received following error.
" --skip-js-minify was unexpected at this time.
C:\Users\AAA\Documents\Titanium_Studio_Workspace\myFirstApp> "C:\Users\AAA\AppData\Roaming\npm\node.exe" "C:\Users\AAA\AppData\Roaming\npm\node_modules\titanium\bin\titanium" --no-colors --no-progress-bars --no-prompt build --platform android --sdk 3.2.2.GA --log-level trace --target emulator --android-sdk C:\Users\AAA\Android.SDK --device-id "10.1" WXGA (Tablet)" --skip-js-minify
[ERROR] Application Installer abnormal process termination. Process exit value was 255
Not sure what is the problem tried re installing the studio No luck.
Thx
umral