Currently I'm trying to run my react native application on my local device using react-native run-android. But I'm getting the following error:-
info Connecting to the development server... warn Failed to connect to
development server using "adb reverse": spawnSync adb ENOENT info
Starting the app... 'adb' is not recognized as an internal or external
command, operable program or batch file. error Failed to start the
app. Error: Command failed: adb shell am start -n
com.tna/com.tna.MainActivity
at makeError (C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules\execa\index.js:338:15)
at tryLaunchAppOnDevice (C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\tryLaunchAppOnDevice.js:58:22)
at C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:104:39
at Array.forEach ()
at runOnAllDevices (C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:102:48)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (C:\Users\deepali\Desktop\Jay\TNA-1-master\node_modules#react-native-community\cli\build\index.js:186:9) info Run CLI with --verbose flag for more details.
My current node version is 12.14.0
Related
Getting language server Python executable.
Waiting for RobotFramework (python) Language Server to finish activating...
Starting RobotFramework Language Server with args: C:\Users\A182573\AppData\Local\Programs\Python\Python37,-u,c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\src\robotframework_ls_main_.py,-v
[Error - 17:01:09] Starting client failed
Error: Launching server using command C:\Users\A182573\AppData\Local\Programs\Python\Python37 with args: -u,c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\src\robotframework_ls_main_.py,-v failed.
at serverOptions (c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\vscode-client\out\extension.js:279:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
It was not possible to start the Robot Framework Language Server. Please update the related robot.language-server configurations.
Launching server using command C:\Users\A182573\AppData\Local\Programs\Python\Python37 with args: -u,c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\src\robotframework_ls_main_.py,-v failed.
Error: Launching server using command C:\Users\A182573\AppData\Local\Programs\Python\Python37 with args: -u,c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\src\robotframework_ls_main_.py,-v failed.
at serverOptions (c:\Users\A182573.vscode\extensions\robocorp.robotframework-lsp-0.41.0\vscode-client\out\extension.js:279:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Found Workspace Folder Value configuration: robotframework-lsp - Robot Framework: Launch .robot file.
Found Workspace Value configuration: robotframework-lsp - Robot Framework: Launch .robot file.
I about to run my protractor test in azure pipeline.
Following steps are success,
npm install
webdriver update
when running "npm run e2e" got below error (highlighted with space),
2020-12-28T11:24:00.1123719Z Date: 2020-12-28T11:24:00.108Z - Hash: 3bfb7dbf8249d8ecd0a9 - Time: 44081ms
2020-12-28T11:24:00.1205386Z ** Angular Live Development Server is listening on localhost:4203, open your browser on http://localhost:4203/ **
2020-12-28T11:24:00.1739298Z [34mℹ[39m [90m「wdm」[39m: Compiled successfully.
2020-12-28T11:24:01.9754480Z [11:24:01] I/launcher - Running 1 instances of WebDriver
2020-12-28T11:24:01.9755656Z [11:24:01] I/direct - Using ChromeDriver directly...
2020-12-28T11:24:06.7970214Z [11:24:06] E/launcher - unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7972134Z (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7980054Z (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
2020-12-28T11:24:06.7981720Z (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280#{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7982724Z [11:24:06] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7983474Z (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7984515Z (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
2020-12-28T11:24:06.7985577Z (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280#{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7986586Z at Object.checkLegacyResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/error.js:546:15)
2020-12-28T11:24:06.7987489Z at parseHttpResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:509:13)
2020-12-28T11:24:06.7988405Z at doSend.then.response (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:441:30)
2020-12-28T11:24:06.7988962Z at process._tickCallback (internal/process/next_tick.js:68:7)
2020-12-28T11:24:06.7989391Z From: Task: WebDriver.createSession()
2020-12-28T11:24:06.7990163Z at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
2020-12-28T11:24:06.7991076Z at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/chrome.js:761:15)
2020-12-28T11:24:06.7992017Z at Direct.getNewDriver (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/driverProviders/direct.js:77:33)
2020-12-28T11:24:06.7992916Z at Runner.createBrowser (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:195:43)
2020-12-28T11:24:06.7993802Z at q.then.then (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:339:29)
2020-12-28T11:24:06.8001078Z at _fulfilled (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:834:54)
2020-12-28T11:24:06.8001877Z at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:863:30
2020-12-28T11:24:06.8002782Z at Promise.promise.promiseDispatch (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:796:13)
2020-12-28T11:24:06.8003556Z at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:556:49
2020-12-28T11:24:06.8004307Z at runSingle (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:137:13)
2020-12-28T11:24:06.8005078Z [11:24:06] E/launcher - Process exited with error code 199
2020-12-28T11:24:07.4394944Z npm ERR! code ELIFECYCLE
2020-12-28T11:24:07.4395828Z npm ERR! errno 1
2020-12-28T11:24:07.4462731Z npm ERR! amaze-commerce#1.0.0 e2etest: `node --max_old_space_size=35000 ./node_modules/#angular/cli/bin/ng e2e`
2020-12-28T11:24:07.4465097Z npm ERR! Exit status 1
2020-12-28T11:24:07.4468705Z npm ERR!
2020-12-28T11:24:07.4472803Z npm ERR! Failed at the amaze-commerce#1.0.0 e2etest script.
2020-12-28T11:24:07.4475619Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-28T11:24:07.4546066Z
2020-12-28T11:24:07.4546683Z npm ERR! A complete log of this run can be found in:
2020-12-28T11:24:07.4547625Z npm ERR! /home/vsts/.npm/_logs/2020-12-28T11_24_07_448Z-debug.log
2020-12-28T11:24:07.4656714Z ##[error]Bash exited with code '1'.
2020-12-28T11:24:07.4737893Z ##[section]Finishing: run e2e test
Please help me on this issue.
Thanks in Advance.
Add below chromeOptions in protractor.conf file
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--disable-gpu', '--no-sandbox','--headless', '--disable-extensions', '--disable-dev-shm-usage']
}
--disable-dev-shm-usage : overcome limited resource problems
// The /dev/shm partition is too small in certain VM environments, causing
// Chrome to fail or crash (see http://crbug.com/715363). Use disable-dev-shm-usage flag to
// work-around this issue (a temporary directory will always be used to create
// anonymous shared memory files).
I am setting up an Android development environment. However, there is a problem in the execution environment. I've already finished the configuration, but I keep saying I can't find the device. However, if you run the server and then run it in the Android studio, it will work normally. What's the problem?
bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
export PATH=${PATH}:$JAVA_HOME/bin
export ANDROID_PATH=/Users/myname/Library/Android
export PATH=$PATH:$ANDROID_PATH/sdk/platform-tools
export PATH=$PATH:$ANDROID_PATH/sdk/emulator
export PATH=$PATH:$ANDROID_PATH/sdk/tools
export PATH=$PATH:$ANDROID_PATH/sdk/tools/bin
But Error
$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug
> Task :app:installDebug FAILED
27 actionable tasks: 9 executed, 18 up-to-date
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 22s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 22s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (/Users/myname/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Is there anyone who has the same problem as me?
Try the following:
> vim ~/.bash_profile
Add the following lines:
export ANDROID_HOME=/Users/myname/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_PATH/emulator
export PATH=$PATH:$ANDROID_PATH/tools/bin
Save changes and restart terminal.
Run ADB and if you got following it will work.
> adb devices
List of devices attached
emulator-5554 device
If you already configured the .bash_profile check the ANDROID_HOME using echo and then you simply need to run your app with this command :
source ~/.bash_profile && npx react-native run-android
UPDATE
Pay attention to this : You should run bash shell NOT zsh shell to be able to run emulator.
React Native run-android shows starting js server... but no server is started like it was starting before (nodejs winodow opens) and in the end it show following error:
Running C:\users\deepa\appdata\local\android\sdk/platform-tools/adb -s
192.168.105.101:5555 reverse tcp:8081 tcp:8081
Starting the app on 192.168.105.101:5555
(C:\users\deepa\appdata\local\android\sdk/platform-tools/adb -s
192.168.105.101:5555 shell am start -n
com.aptencemobileapp/com.aptencemobileapp.MainActivity)...
Starting: Intent { cmp=com.aptencemobileapp/.MainActivity }
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn cmd.exe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Please someone help me!
I don't know but sometimes I also got the same error. You just need to clean android build using following command.
goto your projrct android folder using cd android
hit the gradlew clean
again run the same command you are running.
Hope this will solve your problem.
Finally resolved it!
I reinstalled react-native-cli , nodejs added all paths to system and run following command.
adb reverse tcp:8081 tcp:8081
I have a Jenkins slave node setup with LinuxMint. So we can do some browser testing on a Linux box in Chrome and Firefox.
I have the latest Chromedriver installed where the test can run it and when I go into /var/jenkins/workspace/<project name>/TestAutomation/SeleniumFramework manually and do my run npm <test name> the tests launch the chromedriver and run successfully.
When I go into Jenkins and run my test chromedriver is failing with the following and I am not sure where to go with this.:
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.19.0-32-generic x86_64)
at new bot.Error (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
at Object.bot.response.checkResponse (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
at promise.ControlFlow.runInFrame_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at goog.defineClass.notify (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at promise.Promise.notify_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at promise.Promise.notifyAll_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
at goog.async.run.processWorkQueue (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at new Driver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/chrome.js:810:36)
at DirectDriverProvider.getNewDriver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/driverProviders/direct.js:68:16)
at Runner.createBrowser (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:182:37)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:263:21
at _fulfilled (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:759:13)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1
First Solution:
Have you java 8 installed? If yes, uninstall it and install java 7.
Second Solution:
Downgrade protractor to v1.8.0
~
More informations: https://github.com/angular/protractor/issues/1905
#edit
I found a similar topic as your, the same error in jenkins - linux:
In you jenkins settings add a global property
key : DISPLAY
value:0:0
On your server start Xvfb in the background:
Xvfb :0 -ac -screen 0 1024x768x24 &
link: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9
So I was connecting to the slaves from the Jenkins master via SSH. This wasn't ever going to launch a browser session. I switched over to the Java Web Start option, and it launched the browser just fine.