Android React Native build fail - android

I create the simple React Native Project.
Step 1.
C:>react-native init AwesomeProject
Step 2.
C:>cd AwesomeProject
Step 3.
C:>react-native run-android
After that I faced the following error.
C:\Users\Smith\AwesomeProject>react-native run-android
Scanning 575 folders for symlinks in C:\Users\Smith\AwesomeProject\node_modul
es (13ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory 'C:\Users\Smith\AwesomeProject\android\C:UsersSmithApp
DataLocalAndroidsdk' does not exist.
* 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: 4.774 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
Thanks!!

Android sdk path in your enviroment is not correct.

Related

Execution failed for task ':app:installDebug' react native app [duplicate]

This question already has answers here:
react-native :app:installDebug FAILED
(35 answers)
Closed 9 days ago.
Hi i got this error when i try to run react app on my real android device via : react-native run-android
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to install all
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Try these steps.
Delete node modules folder in your project.
Delete build folder in android/build
Close all running terminals.
Make sure you have installed adb drivers in your environment. If not install adb drivers. (For macOS / For Windows)
Open new terminal window and in your project folder run npm install to re-install node modules.
Finally run your app using react-native run-android
If you are using Android Studio, make sure you run the emulator before running the commands and the emulator API level matches the targetSdk (build.gradle).

Dependency error in React Native for Android

I am writing a React Native App for Android. I initialized the project with the react-native-cli. When I try to run it on Android, I get the following error:
$ react-native run-android
Scanning folders for symlinks in /path/to/myreactnativeproject/node_modules (6ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'myreactnativeproject'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
:myreactnativeproject:unspecified
* 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: 11.226 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
I am using Ubuntu 16.04 and I installed Android Studio 3.0.1. What is the reason for the error?
Edit: When I run it with stacktrace, info and debug, I get the following output:
I can't post the output here, because it is to long: pastebin
I fixed it by adding this to .bashrc:
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH=$JAVA_HOME/bin:$PATH

react-native can't build run android correctly

I was trying to run an android project with this command:
react-native run-android
but it doesn't build anything and print this msg:
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not download javax.inject.jar (javax.inject:javax.inject:1)
> Could not get resource 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
> Could not GET 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed
t: connect
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log outpu
BUILD FAILED
Total time: 2 mins 17.303 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
how can I fix it?
as you can see, you need to run your android simulator first or connect to a device.
so in your terminal
type:
android avd
then create a device if you dont have one, then start it.
If the simulator has run, then you can start building by typing
react-native run-android

react-native run-android Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug

After
react-native init Project
i do :
cd Project and
react-native run-android
my version is : nodejs v6.9.5
emulateur genymotion api 23
I have this error :
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
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: 4.309 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
Install Build Tools revision 23.0.1 on SDK

Ionic app build issue

I am new to ionic. I have developed sample application ionic.
When I try to execute below command it gives gradle error.
$ ionic build android
Below is the build error:
Error: /home/myapp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred starting process 'Gradle build daemon'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Gradle version is 3.3
Android SDK and Android Studio located in /usr/local/ folder
You will either have to move it to your home directory (that involves reinstall).
Or run ionic build commands with sudo
sudo ionic build android
You could technically change permissions of the specific sdk and studio folders but it is not advisable especially in /usr directory.

Categories

Resources