devicefarmer / adbkit Goto Github PK
View Code? Open in Web Editor NEWThis project forked from openstf/adbkit
A pure Node.js client for the Android Debug Bridge.
License: Other
This project forked from openstf/adbkit
A pure Node.js client for the Android Debug Bridge.
License: Other
in vue-cli with electron ,npm i @devicefarmer/adbkit and serve show this:
ERROR Failed to compile with 1 error
This relative module was not found:
8 | write(chunk: Buffer, encoding?: BufferEncoding | typeof callback, callback?: (error: Error | null | undefined) => void): boolean;
| ^
9 | }
10 | //# sourceMappingURL=pulltransfer.d.ts.map
Version: typescript 3.8.3
Greetings from the AppetizerIO team, a mobile test automation platform software.
We love adbkit and have had a long history using it.
We also have a decaffeination progress here: https://github.com/appetizerio/adbkit-decaf . And thanks very much for taking the lead. As our progress is much behind, we would like to switch to the ts version and contribute some of our internal patches/workarounds to the new mainstream:
kill-forward
command under host-serial, which corresponds to the adb forward --remove
featurenode-forge
with node-rsa
, as forge itself is heavy and transitively depends on many stuff, like jquery. Internally, we've replaced it with node-rsa
that saves a lot after webpack-ed.I got pretty scared when I saw that https://github.com/openstf/adbkit had been archived. Thankfully, I found the note at https://github.com/openstf/stf, saying that all of the repositories had been moved here. That message should be posted to all of the old repositories, if at all possible.
I'm not sure if this is the right place to ask this question but is there any typescript typedef anywhere as i could'nt find it anywhere (definitelyTyped). If there's none, will try my best to take some time to contribute. Thank you!
When I try to use adbkit
in an Electron project I'm working on, I encounter the following errors:
ERROR in C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/index.js
[1] Module not found: Error: Can't resolve './src/adb' in 'C:\Users\Noah\...\node_modules\@devicefarmer\adbkit'
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/index.js 9:15-35
[1] @ ../test-plugin/dist/index.js
[1] @ ./src/main.ts
[1] @ multi C:/Users/Noah/.../node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main.ts
[1]
[1] ERROR in C:/Users/Noah/.../node_modules/@devicefarmer/adbkit-logcat/index.js
[1] Module not found: Error: Can't resolve './src/logcat' in 'C:\Users\Noah\...\node_modules\@devicefarmer\adbkit-logcat'
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit-logcat/index.js 9:15-38
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/lib/adb/client.js
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/lib/adb.js
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/index.js
[1] @ ../test-plugin/dist/index.js
[1] @ ./src/main.ts
[1] @ multi C:/Users/Noah/.../node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main.ts
[1]
[1] ERROR in C:/Users/Noah/.../node_modules/@devicefarmer/adbkit-monkey/index.js
[1] Module not found: Error: Can't resolve './src/monkey' in 'C:\Users\Noah\...\node_modules\@devicefarmer\adbkit-monkey'
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit-monkey/index.js 9:15-38
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/lib/adb/client.js
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/lib/adb.js
[1] @ C:/Users/Noah/.../node_modules/@devicefarmer/adbkit/index.js
[1] @ ../test-plugin/dist/index.js
[1] @ ./src/main.ts
[1] @ multi C:/Users/Noah/.../node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main.ts
I'm using electron-webpack to build the binary, but adbkit is included by way of a yarn workspace dependency (I'm using yarn 2 with the node-modules
nodeLinker option).
I can't figure out why I'm having the issue, and I can't reproduce it with a clean electron-webpack
project. Rather than focusing on what's causing the issue, it might be easier to try to find a resolution. For example, is it really necessary to cater to coffeescript users at this point? Could we just remove the check and always return the js version?
Is it possible to use it inside react-native application?
I want to test adb coonect by wifi.
So i use client.connect api to connect remote device.
But if I set ip that not used by any device, error is occured and main process is stopped.
I think that main process should not be stopped tough error is occured.
Let me know how to handle it.
My test code is like below.
let adb = require('adbkit');
let client = adb.createClient();
client.connect('192.168.0.1', '5555')
.then(function(id) {
console.log('connect id:%s', id);
})
.catch(function(err) {
console.error('Something went wrong:', err.stack);
})
Something went wrong: Error: cannot connect to 192.168.0.1:5555: ?곌껐??援ъ꽦?먯쑝濡쒕????묐떟???놁뼱 ?곌껐?섏? 紐삵뻽嫄곕굹, ?몄뒪?몃줈遺�???묐떟???놁뼱 ?곌껐???딆뼱議뚯뒿?덈떎. (10060)
at C:\code\testapp\node_modules\adbkit\lib\adb\command\host\connect.js:30:23
at tryCatcher (C:\code\testapp\node_modules\bluebird\js\main\util.js:26:23)
at Promise._settlePromiseFromHandler (C:\code\testapp\node_modules\bluebird\js\main\promise.js:503:31)
at Promise._settlePromiseAt (C:\code\testapp\node_modules\bluebird\js\main\promise.js:577:18)
at Async._drainQueue (C:\code\testapp\node_modules\bluebird\js\main\async.js:128:12)
at Async._drainQueues (C:\code\testapp\node_modules\bluebird\js\main\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\code\testapp\node_modules\bluebird\js\main\async.js:15:14)
I've tried using the install apk example, but I get the error "client.install is undefined".
I haven't seen this command in the source as well, but only in DeviceClient, but was unable to understand how to create a DeviceClient from device.id.
Regardless, looks like the examples are outdated...
I got a message 3 high severity vulnerabilities
when I install this package.
# npm audit report
async <2.6.4
Severity: high
Prototype Pollution in async - https://github.com/advisories/GHSA-fwr7-v2mv-hh25
No fix available
node_modules/async
@devicefarmer/adbkit-monkey *
Depends on vulnerable versions of async
node_modules/@devicefarmer/adbkit-monkey
@devicefarmer/adbkit *
Depends on vulnerable versions of @devicefarmer/adbkit-monkey
node_modules/@devicefarmer/adbkit
3 high severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Seems like a very dangerous security problem in package async
in @devicefarmer/adbkit-monkey
. How to fix it?
The function should accept any string, but examples include bootloader
, recovery
, sideload
, and fastboot
.
Adb can push folders too, with this library i`m getting EISFOLDER error. I know it uses Stream to push files, but any way to push folders too?
This library does not have any 'run' method, to send raw commands to adb, something like:
client.run('pull local/folder /sdcard/folder')
##ISSUE:
Installing adbkit
does not install it's dependencies' type definitions.
> tsc
node_modules/@devicefarmer/adbkit/dist/src/ExtendedPublicKey.d.ts:1:21 - error TS7016: Could not find a declaration file for module 'node-forge'. '/home/j/dev/poke/node_modules/node-forge/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/node-forge` if it exists or add a new declaration (.d.ts) file containing `declare module 'node-forge';`
1 import { pki } from 'node-forge';
~~~~~~~~~~~~
node_modules/@devicefarmer/adbkit/dist/src/SocketOptions.d.ts:2:22 - error TS7016: Could not find a declaration file for module 'bluebird'. '/home/j/dev/poke/node_modules/bluebird/js/release/bluebird.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/bluebird` if it exists or add a new declaration (.d.ts) file containing `declare module 'bluebird';`
2 import Bluebird from 'bluebird';
...
A fresh project using adbkit
is missing the dependencies from its package-lock.json
:
...
"node_modules/@devicefarmer/adbkit": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@devicefarmer/adbkit/-/adbkit-3.2.0.tgz",
"integrity": "sha512-wfpaoASfRKBBAdyECHViVC534AVethZOMTkECLc6yf+qK46AROpAU3WWT15FuqeYjdQNnAY0SXVy0Y+gysTEZg==",
"dependencies": {
"@devicefarmer/adbkit-logcat": "^2.1.1",
"@devicefarmer/adbkit-monkey": "~1.1.0",
"bluebird": "~3.7",
"commander": "^6.2.1",
"debug": "~4.3.1",
"node-forge": "^0.10.0",
"split": "~1.0.1"
},
...
I believe that the @type
definitions should be included in the above.
Other project have them:
...
"node_modules/@jest/console": {
"version": "27.0.2",
"resolved": "https://registry.npmjs.org/@jest/console/-/console-27.0.2.tgz",
"integrity": "sha512-/zYigssuHLImGeMAACkjI4VLAiiJznHgAl3xnFT19iWyct2LhrH3KXOjHRmxBGTkiPLZKKAJAgaPpiU9EZ9K+w==",
"dependencies": {
"@jest/types": "^27.0.2",
"@types/node": "*",
"chalk": "^4.0.0",
"jest-message-util": "^27.0.2",
"jest-util": "^27.0.2",
"slash": "^3.0.0"
},
...
##PROPOSED FIX:
Is the solution to make them production dependencies instead of dev dependencies?
##WORKAROUND:
include the @type
dependencies in the project using adbkit
... even though it may not use the other libraries...
##STEPS TO REPRODUCE:
npm install @devicefarmer/adbkit
import Adb from '@devicefarmer/adbkit';
npm run build
(or tsc
)when i adb connect
to remote device the first time, i will receive an err "failed to authenticate". But it connect success.
$ adb connect localhost:10007
failed to authenticate to localhost:10007
$ adb devices
List of devices attached
ea24d680 device
localhost:10007 device
when i start adbkit
with DEBUG=* adbkit usb-device-to-tcp -p 10007 ea24d680
, i got logs:
$ DEBUG=* adbkit usb-device-to-tcp -p 10007 ea24d680
Connect with `adb connect localhost:10007`
adb:tcpusb:socket I:A_CNXN Packet {
command: 1314410051,
arg0: 16777217,
arg1: 1048576,
length: 160,
check: 15910,
magic: 2980557244,
data: <Buffer 68 6f 73 74 3a 3a 66 65 61 74 75 72 65 73 3d 73 65 6e 64 72 65 63 76 5f 76 32 5f 62 72 6f 74 6c 69 2c 73 68 65 6c 6c 5f 76 32 2c 74 72 61 63 6b 5f 61 ... > } +0ms
adb:tcpusb:socket Created challenge 'dBlAkTM5U9MFlxmiUbV1fNTS9qo=' +8ms
adb:tcpusb:socket O:A_AUTH +0ms
adb:tcpusb:socket I:A_AUTH Packet {
command: 1213486401,
arg0: 2,
arg1: 0,
length: 256,
check: 31348,
magic: 3081480894,
data: <Buffer 07 3f 06 58 54 0c 7d 17 b1 ee ce bc dd d2 e7 f7 de 02 93 24 0f 5d 20 8b ce c9 1f 03 dd 7b 0b a4 44 47 b1 85 74 95 ac f7 74 23 51 d6 7d 00 8c d3 cf 1a ... > } +4ms
adb:tcpusb:socket Received signature 'Bz8GWFQMfRex7s683dLn994CkyQPXSCLzskfA917C6RER7GFdJWs93QjUdZ9AIzTzxqoW+8K3UE7MISNhErR0OmWKW+dlH2btdJpZa/fIN/kEBe2kyyazX2qpPWsocWI8gUU+hkYuLmjOTYweD13gVBquzA3xQ2vOc09rwrG5jisUikeeDHXzHOqnVZ7ezEG6knt98dHQXiuwyQNLFfH66VI+RdA3f7iMj0nnFi2PyZMAtZho0GKf7UbsDMSr0oSg7MllrXSaF5yxTjXI7jEDVl730EQj3LUSazRlgewx7gac/jrkQEb8grPhl26oeIXNTu+tRE4wAEdHYR2fwyBIg==' +0ms
adb:tcpusb:socket O:A_AUTH +0ms
adb:tcpusb:socket I:A_AUTH Packet {
command: 1213486401,
arg0: 3,
arg1: 0,
length: 718,
check: 61166,
magic: 3081480894,
data: <Buffer 51 41 41 41 41 44 30 33 7a 67 50 72 4a 2f 32 41 75 4c 48 59 62 4b 52 38 6a 6a 5a 59 4d 76 69 62 38 6c 6e 59 2f 76 6f 55 70 45 43 6f 4b 4f 79 4e 62 65 ... > } +4ms
adb:tcpusb:socket Received RSA public key 'UUFBQUFEMDN6Z1BySi8yQXVMSFliS1I4ampaWU12aWI4bG5ZL3ZvVXBFQ29LT3lOYmVCZk0zdXVaSVBBN3haa3VkQUlrODZpWnpweXFvRkpvUFpHQzNrVUNycEpGaHVwclZ0UjR3Y2E2RFJINDlFM3padFpGVmM2S25mZlJzcVlNbEdEd2xJV2VLNEFGd3AzWUJuKzkyRmJMT09jek1HUXQxbnJnL2hsbk9DTysrRUVvNWwwL2N1YnNWSmRyR0l3WHdDUHpmRGJxdEdqRDhJSzlBZHJ6bG5KUVhPTmpOaFM5bU4vZTFDQ2lDR0NDZlRVdVFGS3YreWxYV0gwUk9wWm9TSzR3dEZ4Ti81UWVUbDNtRHRnN3dFb0FQN3ZYbVoyZko2RDdteHZ4ZnhoLzhSa3FvQklkOEtZOEJ6K2l1N3lOOG9zMFRjU1FBOXVvb0FGTTkvOWtodDlZNTFZSVpEdWtDNzlHR04za084NllzZ1J4NTQvcnUxL3RuQW9TMldMWDZtSEEwUk9KeEkvc1ZrajM1SUJ4QUo5bWZUdDcvMGRLRW9rVVExSEwyUU5FZWpndmtCbk5zRkJtNXhIV3BscENYSC80QlpLcDZhQ051ZHJrdlJ5MzZ2d2luaDV6UGV6Z0pncytGOUk4bmk2Z2pNazlBYklGU25xRExnU0gzcklWZlZoL3lwaGVKTEZvVlJNSVlPL0xhTlEydXc5Z2NveUNuT2d4dXB1Nmo3NzdzUUlEakdRbDM3d0hjMlVkR1lvRDRwQnI2azFscE1kejZZNG40cUlHdnRQc3hQWTlYUDNOdkhHZW1HbUozYTByQU1SelJ4MHd4ZDJrcGJmNk9kMjRKUGVxczNSV2lmNEpLaTBMZ2lsQ1U3NWlCV05jRGZPTFA0dzBJRGhKRE5TVEwyTlZLNVkxd0VBQVFBPSB5YmJyaWNoYXJkQGJvZ29uAA==' +1ms
adb:tcpusb:socket Signature verified +34ms
adb:tcpusb:socket Loading device properties to form a standard device ID +2ms
adb:command Send '0017host:transport:ea24d680' +15ms
adb:command Send '000Dshell:getprop' +3ms
adb:tcpusb:socket O:A_CNXN +73ms
$ adb --version
Android Debug Bridge version 1.0.41
Version 30.0.0-6374843
Installed as /usr/local/bin/adb
$ adbkit -V
2.11.1
i think whether adb
not get response from commands
adb:command Send '0017host:transport:ea24d680' +11ms
adb:command Send '000Dshell:getprop' +2ms
As described in this README.md the adb.createClient
's host
option defaults to 'localhost' when not explicitly specified otherwise.
This becomes an issue with nodejs 17, where the default behavior of the dns resolution has been changed to prefer an ipv6 address if one is offered (which varies based on the operating systems and/or how the localhost hostname resolution is configured), see nodejs/node#40537 and nodejs/node#39987.
Other npm packages have had similar issues (e.g. see chrome-launcher issue GoogleChrome/chrome-launcher#251 and the related fix released GoogleChrome/chrome-launcher#253).
As a short term solution, users of this package can explicitly pass '127.0.0.1'
as the host
configuration option.
After calling adbClient.install()
, if the install fails due to lack of space, adbkit will fail with:
PrematureEOFError: Premature end of stream, needed 1 more bytes
at Socket.<anonymous> (.../node_modules/@devicefarmer/adbkit/lib/adb/parser.js:119:32)
at Socket.emit (node:events:539:35)
at Socket.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
missingBytes: 1
}
This is because it's constantly searching for a line containing SUCCESS
or FAILURE
, but the actual output is:
Exception occurred while executing 'install':
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:595)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:3434)
at com.android.server.pm.PackageManagerShellCommand.doRunInstall(PackageManagerShellCommand.java:1446)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1408)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:221)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:5954)
at android.os.Binder.shellCommand(Binder.java:1049)
at android.os.Binder.onTransact(Binder.java:877)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:5938)
at android.os.Binder.execTransactInternal(Binder.java:1285)
at android.os.Binder.execTransact(Binder.java:1244)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:241)
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:152)
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:167)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:803)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:592)
... 13 more
This is confusing, and makes it seem like it's a protocol error. It would be better if this output was detected properly and the command failed explicitly instead.
I think it would be best to look for 'Exception', parse the start of the text, and throw an error containing the real error message. I think just taking the second line of output would be a reasonable approach to get a useful error message in these cases.
Happy to open a PR to implement this, just let me know if that's something you're open to.
The README should be updated with this information.
Is there no release note?
I want to check which parts have been improved or which have been changed for each version.
dist/src/adb/parser.js:178
readByteFlow(howMany, targetStream) {
let tryRead;
let errorListener;
let endListener;
return new bluebird_1.default((resolve, reject /*, onCancel*/) => {
tryRead = () => {
if (howMany) {
const chunk = this.stream.read(howMany);
// Try to get the exact amount we need first. If unsuccessful, take
// whatever is available, which will be less than the needed amount.
while (chunk || this.stream.read()) {
howMany -= chunk.length;
if chunk is null it can't contain length property..
Would it be worth/appreciated to have an online documentation for this project?
I can propose to create one if needed, as the code have a lot of docstrings.
When a forward command is sent with a TCP port, the port is returned from the server. The only usage that I know for it is when you pass port 0 and get a random available port. This is an important feature for me and I would love to implement it, question is, can I do it? Because it will break backward compatibility.
Is this possible?
When I am trying to install apk on device ggetting below error
Installation of package failed PrematureEOFError: Premature end of stream, needed 1 more bytes
at Socket. (/app/node_modules/@devicefarmer/adbkit/lib/adb/parser.js:118:32)
at Socket.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Any help would be appreciated..
Hi and thanks for the great tool, I've been using it for a long time in https://github.com/sitespeedio/browsertime.
A couple of days ago I upgraded from 2.11.3 to 3.2.0. It's been working great but I've run into problem when I run the code in Docker and I cannot understand why. Running it on Big Sur and Ubuntu works fine, but when I run it in a Docker container it fails when I try to pull a file.
The error I get is:
ERROR: TypeError: Cannot read property 'length' of null
at tryRead (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/dist/src/adb/parser.js:178:42)
at bluebird_1.default (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/dist/src/adb/parser.js:202:13)
at Promise.cancellationExecute [as _execute] (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/debuggability.js:406:9)
at Promise._resolveFromExecutor (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:518:18)
at new Promise (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:103:10)
at Parser.readByteFlow (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/dist/src/adb/parser.js:171:16)
at parser.readBytes.then (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/dist/src/adb/sync.js:250:48)
at tryCatcher (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/sitespeed.io/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/release/async.js:15:14)
And the code on Browsertime side is:
https://github.com/sitespeedio/browsertime/blob/main/lib/android/index.js#L86-L98
Using 2.11.3 works fine so it happens after the upgrade. I'm not sure if I missed something on my side or if its a bug. What's the best way to debug it on my side?
I use client.screencap method to get the PNG stream and save the image like this code below
let stream = await client.screencap(deviceId);
stream.pipe(fs.createWriteStream('output.png'));
Rather, I want to resize it first because the output image is so big ( around 3 Mb ). So I try to get the buffer of the stream and resize it by reducing width and height and save the image.
let stream = await client.screencap(deviceId);
let chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
let buffer = Buffer.concat(chunks);
console.log(buffer);
// resize and save
...
But sometime in console.log(buffer), I got
<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 00 04 ... 159002 more bytes>
Sometimes I got empty buffer like:
<Buffer >
I don't know why the buffer is empty. Because of this client.screencap method is not stable? Or they are an any better solution to do a thing like this ?
Hi, I have to switch to some new projects, and now I'm back to android.
It looks like you finally merge my changes.
I was about to add some helpers to access ProcessList and to kill a process.
What part of my PR did you merge?
Did you update the doc to match method parameters?
What your point of view about removing the doc from the README.md, and generating it from the source, to avoid maintaining 2 copies of the doc.
I can't stop tracking device after client.trackDevices() is called.
I want to start and stop tracking device at runtime.
Let me know how to start and stop tracking device dynamically.
If not, can you add API that stop tracking device.
I want to use adbkit module as using 'require' like this.
const adb = require('@devicefarmer/adbkit');
After this, I can't how to use Adb or Client, DeviceClient apis.
Let me know how to use apis of adbkit after getting module by 'require'.
It will be helpful if you share sample code.
When running the DevicesWithPath command against ADB server on windows, the following line is returned:
AAAAAAAA device product:OnePlus7 model:GM1903 device:OnePlus7 transport_id:1
The parsing of this line wrongly parses the encoded fields and returns the following object:
{
device:'transport_id:1',
id:'AAAAAAAA',
model:'device:OnePlus7',
path:'product:OnePlus7',
product:'model:GM1903',
transportId:undefined,
type:'device',
}
Which is incorrect.
SDK Version: r30.0.5-windows
adbkit Version: "3.2.1"
Method is not working anymore
Unhandled rejection FailError: Failure: 'short wait-for-: any'
at /tools/node_modules/@devicefarmer/adbkit/lib/adb/parser.js:183:29
at tryCatcher (/tools/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/tools/node_modules/bluebird/js/main/promise.js:503:31)
at Promise._settlePromiseAt (/tools/node_modules/bluebird/js/main/promise.js:577:18)
at Async._drainQueue (/tools/node_modules/bluebird/js/main/async.js:128:12)
at Async._drainQueues (/tools/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/tools/node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
adb server used to accept the command 'wait-for-any', but now the command has to be 'wait-for-any-device'.
The current start-server command here always uses the default port. If the client was created using a non-default port, adbkit is then unable to properly start the server.
This can be reproduced using the code snippet here: https://gist.github.com/chris-mesmer/a84c83600345c329cd23e1ee22be0b3e
The adb server is never started on the specified port, and the shell command fails:
$ DEBUG=adb:* TARGET_DEVICE=01DAY1T6F1 node reproduce-issue.js
adb:connection Connection was refused, let's try starting the server once +0ms
adb:connection Starting ADB server via 'adb start-server' +1ms
adb:connection CLI: adb start-server +1ms
adb:connection Connection had an error: connect ECONNREFUSED 127.0.0.1:6000 +9ms
error Error: connect ECONNREFUSED 127.0.0.1:6000
I've opened a PR with a fix here #23
My Pixel5 is keep disconnected while I am using it for UI test automation.
I guess it is API 30 specific problem according to the log.
Could you check this issue?
I am using this remote connect api.
Issue Device information:
Pixel5, AndroidOS 11
Note
Galaxy S9+, AndroidOS 10 is working fine for UI test automation.
STF provider's log:
[09061FDD400235] using 'start-foreground-service' command for API 30
2021-07-05T02:16:51.528Z IMP/device:plugins:service 690 [09061FDD400235] Service relaunched in 1075ms
2021-07-05T02:16:51.595Z INF/device:plugins:display 690 [09061FDD400235] Rotation changed to 0
2021-07-05T02:16:51.595Z INF/device:plugins:screen:stream 690 [09061FDD400235] Keeping 0 as current frame producer rotation
2021-07-05T02:16:51.684Z INF/device:plugins:browser 690 [09061FDD400235] Updating browser list
2021-07-05T02:16:54.382Z IMP/device:plugins:service 690 [09061FDD400235] Service connection ended, attempting to relaunch
2021-07-05T02:16:54.382Z INF/device:plugins:service 690 [09061FDD400235] Launching service
2021-07-05T02:16:54.383Z INF/device:plugins:service 690 [09061FDD400235] using 'start-foreground-service' command for API 30
2021-07-05T02:16:59.386Z FTL/device:plugins:service 690 [09061FDD400235] Service connection could not be relaunched TimeoutError: operation timed out
at afterTimeout (/app/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/main/timers.js:11:15)
at Timeout.timeoutTimeout [as _onTimeout] (/app/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/main/timers.js:53:9)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
2021-07-05T02:16:59.386Z FTL/util:lifecycle 690 [09061FDD400235] Shutting down due to fatal error
2021-07-05T02:16:59.395Z INF/provider 1 [*] Cleaning up device worker "09061FDD400235"
2021-07-05T02:16:59.395Z ERR/provider 1 [*] Device worker "09061FDD400235" died with code 1
2021-07-05T02:16:59.395Z INF/provider 1 [*] Restarting device worker "09061FDD400235"
2021-07-05T02:17:00.129Z INF/device:support:push 702
ADB log:
adb W 07-04 23:13:18 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb W 07-04 23:16:28 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb W 07-04 23:19:37 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb W 07-04 23:22:47 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb W 07-04 23:25:58 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb W 07-05 02:16:47 7 7 sockets.cpp:279] timeout expired while flushing socket, closing
adb I 07-05 03:35:45 7 80626 transport.cpp:331] 09061FDD400235: read failed: Protocol error
adb I 07-05 03:35:45 7 80626 transport.cpp:812] 09061FDD400235: connection terminated: read failed
adb I 07-05 03:35:45 7 7 adb.cpp:145] 09061FDD400235: offline
adb I 07-05 03:35:45 7 7 transport.cpp:916] destroying transport 09061FDD400235
adb I 07-05 03:35:45 7 7 transport.cpp:402] BlockingConnectionAdapter(09061FDD400235): stopping
adb E 07-05 03:35:45 7 80627 transport_usb.cpp:166] remote usb: 1 - write terminated: Connection timed out
I am also attaching my Galaxy's log when it is remote connected and running test automation:
2021-07-05T03:35:45.640Z IMP/device:plugins:service 23 [1c62a3cc17037ece] Service connection ended, attempting to relaunch
2021-07-05T03:35:45.640Z INF/device:plugins:service 23 [1c62a3cc17037ece] Launching service
2021-07-05T03:35:45.640Z INF/device:plugins:service 23 [1c62a3cc17037ece] using 'start-foreground-service' command for API 29
2021-07-05T03:35:45.641Z WRN/device:plugins:touch 23 [1c62a3cc17037ece] Shell keeping minitouch running ended unexpectedly
2021-07-05T03:35:45.642Z INF/device:plugins:touch 23 [1c62a3cc17037ece] Disconnecting from minitouch service
2021-07-05T03:35:45.643Z FTL/util:lifecycle 23 [1c62a3cc17037ece] Forward shell ended; we shall share its fate
2021-07-05T03:35:45.644Z FTL/util:lifecycle 23 [1c62a3cc17037ece] Shutting down due to fatal error
2021-07-05T03:35:45.656Z INF/provider 1 [*] Device worker "1c62a3cc17037ece" has retired
2021-07-05T03:35:47.685Z INF/provider 1 [*] Found device "1c62a3cc17037ece" (offline)
2021-07-05T03:35:47.765Z INF/provider 1 [*] Registered device "1c62a3cc17037ece"
2021-07-05T03:35:47.765Z INF/provider 1 [*] Device "1c62a3cc17037ece" is now "authorizing" (was "offline")
2021-07-05T03:35:47.765Z INF/provider 1 [*] Device "1c62a3cc17037ece" is now "offline" (was "authorizing")
2021-07-05T03:35:47.766Z INF/provider 1 [*] Device "1c62a3cc17037ece" is now "device" (was "offline")
2021-07-05T03:35:48.101Z INF/device:support:push 726 [1c62a3cc17037ece] Sending output to "tcp://dev-triproxy:7270"
2021-07-05T03:35:48.103Z INF/device 726 [1c62a3cc17037ece] Preparing device
2021-07-05T03:35:48.438Z INF/device:support:sub 726 [1c62a3cc17037ece] Receiving input from "tcp://dev-triproxy:7250"
2021-07-05T03:35:48.438Z INF/device:support:sub 726 [1c62a3cc17037ece] Subscribing to permanent channel "*ALL"
2021-07-05T03:35:48.481Z INF/device:support:properties 726 [1c62a3cc17037ece] Loading properties
2021-07-05T03:35:48.518Z INF/device:support:sdk 726 [1c62a3cc17037ece] Supports SDK 29
2021-07-05T03:35:48.519Z INF/device:support:abi 726 [1c62a3cc17037ece] Supports ABIs arm64-v8a, armeabi-v7a, armeabi
2021-07-05T03:35:48.682Z INF/device:resources:minicap 726 [1c62a3cc17037ece] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/bin/minicap" as "/data/local/tmp/minicap"
2021-07-05T03:35:48.683Z INF/device:resources:minicap 726 [1c62a3cc17037ece] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/lib/android-29/minicap.so" as "/data/local/tmp/minicap.so"
2021-07-05T03:35:48.683Z INF/device:resources:minicap 726 [1c62a3cc17037ece] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk"
2021-07-05T03:35:48.900Z INF/device:resources:service 726 [1c62a3cc17037ece] Checking whether we need to install STFService
2021-07-05T03:35:48.963Z INF/device:resources:service 726 [1c62a3cc17037ece] Running version check
2021-07-05T03:35:49.343Z INF/device:resources:service 726 [1c62a3cc17037ece] STFService up to date
2021-07-05T03:35:49.344Z INF/device:plugins:service 726 [1c62a3cc17037ece] Launching agent
2021-07-05T03:35:49.803Z INF/device:plugins:service 726 [1c62a3cc17037ece] Agent says: "Starting minitouch agent"
2021-07-05T03:35:49.835Z INF/device:plugins:service 726 [1c62a3cc17037ece] Agent says: "Listening on @stfagent"
2021-07-05T03:35:49.911Z INF/device:plugins:service 726 [1c62a3cc17037ece] Launching service
2021-07-05T03:35:49.913Z INF/device:plugins:service 726 [1c62a3cc17037ece] using 'start-foreground-service' command for API 29
2021-07-05T03:35:49.914Z INF/device:plugins:service 726 [1c62a3cc17037ece] Agent says: "InputClient started"
2021-07-05T03:35:49.967Z INF/device:plugins:display 726 [1c62a3cc17037ece] Reading display info
2021-07-05T03:35:50.004Z INF/device:plugins:phone 726 [1c62a3cc17037ece] Fetching phone info
2021-07-05T03:35:50.018Z INF/device:plugins:identity 726 [1c62a3cc17037ece] Solving identity
2021-07-05T03:35:50.024Z INF/device:plugins:solo 726 [1c62a3cc17037ece] Subscribing to permanent channel "EHmVcv8lrBvZaJxDRUhvwysBwaM="
2021-07-05T03:35:50.025Z INF/device:plugins:screen:stream 726 [1c62a3cc17037ece] ScreenGrabber option set to minicap-bin
2021-07-05T03:35:50.026Z INF/device:plugins:screen:stream 726 [1c62a3cc17037ece] Starting WebSocket server on port 7412
2021-07-05T03:35:50.029Z INF/device:plugins:screen:stream 726 [1c62a3cc17037ece] creating FrameProducer: minicap-bin
2021-07-05T03:35:50.210Z INF/device:resources:minitouch 726 [1c62a3cc17037ece] Installing "/app/node_modules/@devicefarmer/minitouch-prebuilt/prebuilt/arm64-v8a/bin/minitouch" as "/data/local/tmp/minitouch"
2021-07-05T03:35:50.249Z WRN/device:plugins:data 726 [1c62a3cc17037ece] Unable to find device data { serial: '1c62a3cc17037ece',
platform: 'Android',
manufacturer: 'SAMSUNG',
operator: 'SKT',
model: 'SM-G965N',
version: '10',
abi: 'arm64-v8a',
sdk: '29',
product: 'star2lteks',
cpuPlatform: 'universal9810',
openGLESVersion: '3.2',
marketName: 'Galaxy S9+',
display:
{ id: 0,
width: 1080,
height: 2220,
xdpi: 397.5644836425781,
ydpi: 397.09796142578125,
fps: 60.000003814697266,
density: 2.625,
rotation: 0,
secure: true,
size: 6.215621746632143,
url: 'ws://stf.linecorp.com/d/KOREA_BS_1/1c62a3cc17037ece/7412/' },
phone: { network: 'UNKNOWN' } }
2021-07-05T03:35:50.251Z INF/device:plugins:touch 726 [1c62a3cc17037ece] Touch origin is top left
2021-07-05T03:35:50.252Z INF/device:plugins:touch 726 [1c62a3cc17037ece] Requesting touch consumer to start
2021-07-05T03:35:50.253Z INF/device:plugins:touch 726 [1c62a3cc17037ece] Launching touch service
2021-07-05T03:35:50.262Z INF/device:plugins:touch 726 [1c62a3cc17037ece] Connecting to minitouch service
2021-07-05T03:35:50.280Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "open: Permission denied"
2021-07-05T03:35:50.281Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event3 for inspectionopen: Permission denied"
2021-07-05T03:35:50.281Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event2 for inspectionopen: Permission denied"
2021-07-05T03:35:50.283Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event0 for inspectionopen: Permission denied"
2021-07-05T03:35:50.284Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event4 for inspectionopen: Permission denied"
2021-07-05T03:35:50.284Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event7 for inspectionopen: Permission denied"
2021-07-05T03:35:50.285Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event5 for inspectionopen: Permission denied"
2021-07-05T03:35:50.286Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event6 for inspectionopen: Permission denied"
2021-07-05T03:35:50.290Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Unable to open device /dev/input/event1 for inspectionUnable to find a suitable touch device"
2021-07-05T03:35:50.291Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "using Android InputManager"
2021-07-05T03:35:50.372Z INF/device:plugins:touch 726 [1c62a3cc17037ece] minitouch says: "Connection established"
2021-07-05T03:35:50.374Z INF/device:plugins:touch 726 [1c62a3cc17037ece] Reading minitouch banner
2021-07-05T03:35:50.385Z INF/device:plugins:vnc 726 [1c62a3cc17037ece] Starting VNC server on port 7414
2021-07-05T03:35:50.390Z INF/device:plugins:browser 726 [1c62a3cc17037ece] Loading browser list
2021-07-05T03:35:50.417Z INF/device:plugins:browser 726 [1c62a3cc17037ece] Updating browser list
2021-07-05T03:35:50.422Z INF/device:plugins:mute 726 [1c62a3cc17037ece] Will not mute master volume
2021-07-05T03:35:50.600Z INF/device:resources:minirev 726 [1c62a3cc17037ece] Installing "/app/vendor/minirev/arm64-v8a/minirev" as "/data/local/tmp/minirev"
2021-07-05T03:35:50.643Z INF/device:plugins:forward 726 [1c62a3cc17037ece] Launching reverse port forwarding service
2021-07-05T03:35:50.652Z INF/device:plugins:forward 726 [1c62a3cc17037ece] Connecting to reverse port forwarding service
2021-07-05T03:35:50.773Z INF/device 726 [1c62a3cc17037ece] Fully operational
Hi.
I want to suggest creating support branch for adbkit@2.
Version 2 still almost 30 times more popular than v3 (60 times if you also count original adbkit).
The goal is to provide 100% compatible version (with openstf/adbkit) written in TypeScript.
I prepared code in my fork: 5bd7a66...drauggres:master
It contains:
UPD:
Bluebird
imports@devicefarmer/adbkit-logcat
to v2.1.1 (contains TypeScript definitions)cc: @koral--
The pm list packages
command has some flags that allow to filter the list of returned packages:
-d: filter to only show disabled packages
-e: filter to only show enabled packages
-s: filter to only show system packages
-3: filter to only show third party packages
It would be nice if this flag can be supplied when using the client.getPackages
function.
I think a raw, optional string would be the easiest solution here.
If you are interested in such a change, I can provide a MR for this.
TypeError: Cannot read property 'prototype' of undefined
at extend (45.bundle.js:20620)
at 45.bundle.js:20626
at Object.../node_modules/@devicefarmer/adbkit/lib/adb/sync/stats.js (45.bundle.js:20670)
at webpack_require (bundle.js:64)
at Object. (45.bundle.js:20155)
at Object.../node_modules/@devicefarmer/adbkit/lib/adb/sync.js (45.bundle.js:20481)
at webpack_require (bundle.js:64)
at Object.../node_modules/@devicefarmer/adbkit/lib/adb/client.js (45.bundle.js:15877)
at webpack_require (bundle.js:64)
at Object. (45.bundle.js:15732)
at Object.../node_modules/@devicefarmer/adbkit/lib/adb.js (45.bundle.js:15760)
at webpack_require (bundle.js:64)
at Object. (45.bundle.js:15716)
at Object.../node_modules/@devicefarmer/adbkit/index.js (45.bundle.js:15718)
at webpack_require (bundle.js:64)
at Object.../awesome-android/lib/browser/adbkit-sdk-wrapper.js (56.bundle.js:109)
to get the UI elements (In XML format) you can achieve this by using this command
adb exec-out uiautomator dump /dev/tty
I use device.shell('exec-out uiautomator dump /dev/tty')
from adbkit, But it doesn't work.
So I used child_process instead (native library in Node.js) to call this command.
const { spawn } = require("child_process");
const spawnChild = async (command: string, args: Array<string>) => {
const child = spawn(command, args);
let data = "";
for await (const chunk of child.stdout) {
data += chunk;
}
let error = "";
for await (const chunk of child.stderr) {
error += chunk;
}
const exitCode = await new Promise((resolve, reject) => {
child.on("close", resolve);
});
if (exitCode) {
throw new Error(`subprocess error exit ${exitCode}, ${error}`);
}
return data;
};
spawnChild("adb", ["exec-out", "uiautomator", "dump", "/dev/tty"]).then(result => console.log(result))
I want to know how to implement adb exec-out with adbkit library
Or is there any method or API from adbkit to get the UI elements of an Android device ?
I got some moderate to low warnings/errors while installing the library:
While running 'npm audit' https://pastebin.com/Zjshpu9A
[app] Device 127.0.0.1:4444 was plugged in
[app] Something went wrong: Error: failed to authenticate to 127.0.0.1:4444
[app] at /home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/lib/adb/command/host/connect.js:30:23
[app] at tryCatcher (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/util.js:26:23)
[app] at Promise._settlePromiseFromHandler (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:503:31)
[app] at Promise._settlePromiseAt (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:577:18)
[app] at Async._drainQueue (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:128:12)
[app] at Async._drainQueues (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:133:10)
[app] at Immediate.Async.drainQueues [as _onImmediate] (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:15:14)
[app] at processImmediate (internal/timers.js:456:21)
[app] Unhandled rejection FailError: Failure: 'device unauthorized.
[app] This adb server's $ADB_VENDOR_KEYS is not set
[app] Try 'adb kill-server' if that seems wrong.
[app] Otherwise check for a confirmation dialog on your device.'
[app] at /home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/lib/adb/parser.js:183:29
[app] at tryCatcher (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/util.js:26:23)
[app] at Promise._settlePromiseFromHandler (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:503:31)
[app] at Promise._settlePromiseAt (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:577:18)
[app] at Async._drainQueue (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:128:12)
[app] at Async._drainQueues (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:133:10)
[app] at Immediate.Async.drainQueues [as _onImmediate] (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:15:14)
[app] at processImmediate (internal/timers.js:456:21)
[app] Unhandled rejection FailError: Failure: 'device unauthorized.
[app] This adb server's $ADB_VENDOR_KEYS is not set
[app] Try 'adb kill-server' if that seems wrong.
[app] Otherwise check for a confirmation dialog on your device.'
[app] at /home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/lib/adb/parser.js:183:29
[app] at tryCatcher (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/util.js:26:23)
[app] at Promise._settlePromiseFromHandler (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:503:31)
[app] at Promise._settlePromiseAt (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/promise.js:577:18)
[app] at Async._drainQueue (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:128:12)
[app] at Async._drainQueues (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:133:10)
[app] at Immediate.Async.drainQueues [as _onImmediate] (/home/minsu15.seo/git/electron/honeyface/node_modules/adbkit/node_modules/bluebird/js/main/async.js:15:14)
[app] at processImmediate (internal/timers.js:456:21)
After this issue. I found confirmation dialog on your device and check "ok" to allow access and checked 127.0.0.1:4444's status changed from unauthorized to authorized.
But tracker.on('add', function (device) {} is not called any more.
Let me know how to be called tracker.on('add', function (device) {} in this situation.
Hello everyone, I got this error and i have tried to uninstall and install but cannot solve. If you have experience to fix this error please help me.
"dependencies": {
"@devicefarmer/adbkit": "^3.2.3",
}
Thank all you.
I use client.connect api to connect and debug remote android device in window OS.
When I use client.connect api, there is no reaction and error.
Just not working.
But if i use adb command in cmd like below, it is working.
adb connect 192.168.0.11:5555
Let me know why client.connect api is not working and how to debug this issue.
os: macOS Big Sur 11.4
The following issue appears both "adbkit": "^2.11.1", and "@devicefarmer/adbkit": "^3.2.0".
Issue:
We are running emulators, and after shutting down the emulator, the adb have tcp connections in close_wait state, the number keeps on increasing, and exhaust system limit after sometimes.
I have an adb client running on electron, and everything is okay (tracking devices, listing devices) until at some point suddenly network connection dies and its throwing this error below.
\\ error A
{"method":"AndroidDevices, constructor","description":"adbClient error Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:182:27)"}
Then i try to restart the client again and it's throwing this error
\\ error B
LogService.ts:44 {"method":"AndroidDevices, constructor","description":"adbkit error TypeError:
v is not a function\n at _ (C:\\Dummy\\resources\\app.asar\\build\\app.js:3:100879)\n at Function.t.promisify (C:\\Dummy\\resources\\app.asar\\build\\app.js:3:101039)\n at t._exec
(C:\\Dummy\\resources\\app.asar\\build\\app.js:309:161916)\n at t.startServer
(C:\\Dummy\\resources\\app.asar\\build\\app.js:309:161818)\n at C:\\Dummy\\resources\\app.asar\\build\\app.js:309:161285\n at
c (C:\\Dummy\\resources\\app.asar\\build\\app.js:3:117139)\n at w._settlePromiseFromHandler
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:90287)\n at w._settlePromiseAt
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:91560)\n at w._settlePromises
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:93407)\n at a._drainQueue
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:55788)\n at a._drainQueues
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:55849)\n at Immediate.drainQueues [as _onImmediate]
(C:\\Dummy\\resources\\app.asar\\build\\app.js:3:54148)\n at processImmediate (internal/timers.js:443:21)"}
Then i tried to execute the adb binary from the command line adb devices
and it shows a message written that there's no adb server currently running and it creates one. When i try to run the client again,the error B now dissapear. So what i discovered here is that the error B happened due to the server not being created by client during initialization.
Why adbclient was not been able to create the server automatically after it died once as mentioned here link
When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process.
Hi, can we get an example code block on how to use device.openProcStat()
? I'm struggling to use it correctly, so any sort of sample usage would be greatly helpful. Thanks.
Whether AdbKit-like capabilities can be implemented on ios devices
Hi,
I am trying to push item to device like this:
async function _pushItem(deviceClient: DeviceClient, deviceFilePath: string, localFilePath: string): Promise<boolean> {
const transfer = await deviceClient.push(localFilePath, deviceFilePath);
return new Promise((resolve, reject) => {
try {
transfer.on('end', () => resolve(true));
transfer.on('error', () => reject(new Error(`Error while pushing item: ${localFilePath}`)));
} catch (err) {
reject(new Error(`Error when pushing item ${localFilePath}: ${err}`));
}
});
}
But when the directory is read-only I am getting this error:
rejected promise not handled within 1 second: FailError: Failure: 'couldn't create file: Permission denied'
What is the correct way to handle errors when pushing item to the device?
When I push directory I need recursively creating folders, but mkdir by shell cmd created many delays.
Please add sync.mkdir command
On STF 3.6.0
I cannot run stf provider
because of the following error:
adb.createClient is not a function
This does not apply to every single example snippet.
This is the old way to access functionality on a particular ADB device:
const client = Adb.createClient();
const serial = '1234';
client.reboot(serial);
This is the new way to do the same thing:
const client = Adb.createClient();
const device = client.getDevice('1234');
device.reboot();
adbClient.getDevice()
is also not documented in the README.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.