React Native Could not create ADB Bridge Error - android-studio

JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Download https://jcenter.bintray.com/com/facebook/react/react-native/0.20.1/react-native-0.20.1.pom
....# a bunch of downloads here
:app:assembleDebug
:app:installDebug
05:13:20 E/adb: Unable to obtain result of 'adb version'
:app:installDebug FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: Could not create ADB Bridge. ADB location: D:\Android\sdk\platform-tools\adb.exe
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I'm using Windows machine and the android studio and have followed the tutorial over at
https://facebook.github.io/react-native/docs/getting-started.html
I'm stuck at this as i cannot run the 'react-native run-android' on command prompt
Also, running adb version gives
Android Debug Bridge version 1.0.32
Revision eac51f2bb6a8-android

I have solved this problem ..if you are using emulator then follow React-Native, Android, Genymotion: ADB server didn't ACK... if you are using your device over usb for development then it is an error of your adb path.. set the path to D:\Android\sdk\platform-tools... in pc properties->advanced settings->environment variables->system variables..it worked for me.

I have another solution, If you are using emulator then make sure its running before you start you react native app. Some time you may need to close the application(like skype) those are using same port:8081(default used by react native application) before running react native app.

Related

Problem processing route in Ember.js app when building and running app in Android studio emulator

Trying to build and run an Ember app with Capacitor on virtual device in Android studio. Build and installation goes fine until the app is launched and stops when trying to process a spesific route. The problem only occurs when building from windows, no problem on Mac. The app is communicating with a jsonapi.
Error message in chrome device inspector: "Error while processing route [routename]"
I have tried with physical device connected getting the same message. Also tried with Genymotion plugin.
Capture of browser console:
chrome console error
And this is what logcat is giving:
logcat error
I also have some errors reported from the IDE (Android Studio) not related to running the Emulator but occurs when opening the IDE:
Android Studio errors. In case this has something to do with it.
Solution in this case:
Had to reinstall node js with another older version. Did an npm cache clean and built the app all over again. Also made sure to open the project with npx cap open android.

Android Build Failing with Command, but not in Android Studio

I'm learning React Native and all of sudden my Android build has started to fail. When I type the command 'react-native run-android' the build fails with following error
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
java.lang.NullPointerException (no error message)
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 1s 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 closed and re-opened the terminal, emulator, and Android Studio and made sure that the emulator is running before typing the command. But the build still fails. However if I go into Android Studio and click the 'Play' button (Run App), and the build succeeds and my App is displayed on the Android emulator.
I have also tried copying my project to another folder and all of the same errors still occur. Not a pressing issue, more just of an annoyance so if you have any suggestions that'd be great :)
Same error occurs for me when i change gradle version in build.gradle file.
This error of NullPointerException occurs when the version in build.gradle does not match the version installed in your project root folder.
Then change to the same version resolved the error.

Gradle build error using react native

I get this error when trying to run an app on an android emulator(Android Studio) from a console window:
$ react-native run-android
Scanning folders for symlinks in C:\Users\Brian\desktop\codervets\arrive-alive\aa_app\node_modules (27726ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 4m 51s
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
And yet my sdk directory in android studio has the following directory:
C:\Users\Brian\AppData\Local\Android\Sdk
Has anyone else ran into this issue? If so, how do I fix it?
The error states:
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
And you say your SDK is in:
C:\Users\Brian\AppData\Local\Android\Sdk
Since those aren't the same directory, my guess is that's the problem. Are you perhaps logged in as the wrong user? You're going to want to check that ANDROID_HOME is set correctly.
So I'm not sure why it was setup the way it was, but the way to fix it is to go to Advanced System Settings → Environment variables. Thank you to #Rich Churcher for the link to a proper tutorial (it's outdated but the steps worked).

react-native installation in ubuntu

smackuser#smackcoders:~/Documents/projects/Awesome$ react-native run-android
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.562 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
Go to Android SDK Manager and under tools install Android SDK Build-tools 23.0.1.
You can access SDK Manager by either typing android in your terminal or going to your android-sdk/tools directory and from there typing ./android

Sign Application in Android Studio

I am a web developer and I recently decided to learn how to build apps in Android, using the first-party IDE Android Studio.
I spent a few days designing a tutorial app, which I managed to run in an emulator, and then I've been programming and designing the layout for my own app.
However, I've been running into a problem when I try to test the app.
Waiting for device.
Target device: emulator-5556 (Nexus7_2) Uploading file
local path: C:\{file_path}\{app}-release-unsigned.apk
remote path: /data/local/tmp/{app_name}
Installing {app_name}
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/{app_name}"
pkg: /data/local/tmp/{app_name}
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
By looking up this error online, I've figured out that I need to sign my app, but I haven't figure out a way for this to work in the case of Android Studio. Modifying the ant build.xml file doesn't work and other methods of signing don't seem to work either.
There is an option to Generate a Signed APK, and I exported an app that was signed. However, I cannot seem to put that apk into my emulator.
If there is anyone more knowledgeable about how to use Android Studio, I would appreciate the assistance in how to sign my apk with the software. Thanks.
Output from Tutorial App
I copied all the code that wasn't included with the new project. This application does work in the emulator.
Waiting for device.
Target device: emulator-5556 (Nexus7_2)
Uploading file
local path: C:\{file_path}\QuoteReader-debug-unaligned.apk
remote path: /data/local/tmp/{app_name}
Installing {app_name}
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/{app_name}"
pkg: /data/local/tmp/{app_name}
Success
Launching application: ...quotereader.MainActivity.
DEVICE SHELL COMMAND: am start -n "...quotereader.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp={app_name}/.MainActivity }
I have found that if you delete the app on your phone then it should work when you run it again.

Resources