Unable to install APK to usb device
I use this library in my project involving a usb connected device, and this library just hangs forever. I am using it as a git repo in cargo.toml. I think that i am doing something wrong.
use adb_client::{ADBDeviceExt, ADBUSBDevice};
fn main() {
let product_id = 0x0000;
let vendor_id = 0x0000; // edited out
let mut device = ADBUSBDevice::new(vendor_id, product_id).unwrap();
device
.install(&"/home/zamonary1/Загрузки/SlimeVR-android.apk")
.unwrap();
}
It was running for 4.6 minutes and i had to stop it manually
Hello, have you tried running it with RUST_LOG=debug ?
Also have you accepted the prompt on the device when running the command ?
I was not prompted on my phone because i already accepted the connection to this PC while using google's adb.
I waited for a couple of minutes with set envvar but there is no output whatsoever. Assuming that code works on your setup, that may be the android to blame. My device is nothing phome 2a plus with android 15 and latest update. I could try the example on some of my older devices tomorrow.
I just checked on it and it gave me something while i was typing. May be the faulty usb tho.
I was not prompted on my phone because i already accepted the connection to this PC while using google's adb.
I waited for a couple of minutes with set envvar but there is no output whatsoever. Assuming that code works on your setup, that may be the android to blame. My device is nothing phome 2a plus with android 15 and latest update. I could try the example on some of my older devices tomorrow.
Yes, this would help to debug if this is the phone, the library or your computer
I just checked on it and it gave me something while i was typing. May be the faulty usb tho.
Are you using a logging crate in your executable ? This is weird that nothing is display at all by the library
I tried it on another device running android 10, here is the backtrace with RUST_BACTRACE=full
Can you try #111 ? This should fix your issue
I don't know why did you close the issue because it is not resolved. The code with android 15 device produces output now, but it errors out still.
Please, reopen the issue
I can't help you if you don't provide any logs :/ this backtrace does not hold much information..
Please use log crate and a user-facing logging crate like env_logger. Then run your program with RUST_LOG=trace and paste the output
Good news - running code with the latest adb_client release installs the apk on device
Bad news - unwrap() catches some error anyway. Also if you try to run the code again it errors out until you reattach device's cable. I've attached the outputs with RUST_LOG=trace for both runs.
Thanks for the report and the backtraces, can you try #114 ? Does it fix your issue ?
Unfortunately, the problem is the same. The first run installs the app and throws an error, other runs error out without doing anything. I wasn't even sure that was the new commit but i checked the changes manually. I've tested on android 10 and android 15 devices. I don't count the android 6 device because it refuses to work even with google's adb. I really appreciate your work and understand how hard it is to work on such a big codebase. Thank you anyway, i think that i'll try to poke around your code too and find more clues.
Edit: here's the log
Hmmm
Can you provide a minimum reproductible example of this bug ? This would greatly help me debugging it :)
Sure! Pretty much no changes from the original source
use adb_client::{ADBDeviceExt, ADBUSBDevice};
use log::*;
fn main() {
env_logger::init();
// lsusb:
// 0e8d:201c MediaTek Inc. A142P
let vendor_id = 0x0e8d;
let product_id = 0x201c; // A142P - android 15
let mut device = ADBUSBDevice::new(vendor_id, product_id).unwrap();
device
.install(&"/path/to/file.apk")
.unwrap();
}
Hello, have you been able to replicate the issue?
Apart from the related PR, I cannot reproduce on any of my devices..
That's really unfortunate, i'll try the code on my laptops and come back with feedback
Good news - i ran the compiled binary on my second machine running arch, and the code worked perfectly with no errors at the end during furst run, but on the second run i am getting the same ONNX, AUTH error. I am going to compile my other project with the latest version of adb_client and send over to friend for testing under windows.
So turns out, the error was just partially because of my setup. I'll test the code under VM to find what exactly breaks it.
Hello, my tester has sent me the logs from the app utilizing adb_client, the app crashes and logs contain the following error:
ERROR - error while sending CLSE message: no write endpoint setup
Please note that he was on windows OS.
I think that the error occurs here.
I am also encountering this issue. Logging around the install method indicates its hanging inside of std::io::copy, so the writer is not allowing the flow to continue, probably because it's not properly parsing an ack from the Android device.
In my experience it alternates between two states. One run of the program will hang at the copy, the next one will immediately return the error Failed to connect to USB device: USB Error: Input/Output Error, then the cycle repeats.