Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RROR Main: Cannot start client: Command D:\software\platform-tools ["shell", "dumpsys", "package", "com.genymobile.gnirehtet"] failed: 拒绝访问。 (os error 5) #526

Open
flyfig opened this issue Jan 18, 2024 · 3 comments

Comments

@flyfig
Copy link

flyfig commented Jan 18, 2024

question:
d:\software\gnirehtet-rust-win64>gnirehtet run
2024-01-18 17:11:49.676 INFO Main: Starting relay server on port 31416...
2024-01-18 17:11:49.676 INFO Main: Checking gnirehtet client...
2024-01-18 17:11:49.678 ERROR Main: Cannot start client: Command D:\software\platform-tools ["shell", "dumpsys", "package", "com.genymobile.gnirehtet"] failed: 拒绝访问。 (os error 5)
2024-01-18 17:11:49.681 INFO Relay: Relay server started

Attempted to run with administrator。

@flyfig
Copy link
Author

flyfig commented Jan 18, 2024

OS is windows 11

@rom1v
Copy link
Collaborator

rom1v commented Jan 31, 2024

2024-01-18 17:11:49.678 ERROR Main: Cannot start client: Command D:\software\platform-tools ["shell", "dumpsys", "package", "com.genymobile.gnirehtet"] failed: 拒绝访问。 (os error 5)

Did you set the ADB environment variable to D:\software\platform-tools? It must point to the executable (D:\software\platform-tools\adb.exe), not its parent folder.

@111-MPLSR-xoxo
Copy link

To clarify, when I say device I mean the Android device, not the windows device.

ERROR Main(, no value)

0. Get Android SDK Platform-Tools
You need to start with downloading and extract (unzip) the Android SDK Platform-Tools from https://developer.android.com/studio/releases/platform-tools.

(0.5. Relocate Android SDK Platform-Tools
Put the extracted folder in a place outside of your downloads folder; a place appropriate for system tools)

1. Set environmental variable
First, copy the folder location from 0/0.5. Then, open explorer>right-click 'this PC'>'properties'>'Advanced system settings'>'Environment(al) variables'> Under system variables look for 'Path', highlight it and click on 'edit'>Now click 'New' and paste the file location here.

Now windows is familiarized with the android dev tools. You can run cmd and run 'adb' which should give you an overview of its functions. If not, you should repeat the steps above and troubleshoot that first before continueing.

3.a. Check connection status
Run the 'gnirethet-run' command line in the gnirethet folder. If there is no MAIN error line, everything is set up properly and after a brief period, the cmd window should be flooded with lines ending on 'open'. When your android device performs any action through this connection, a line will pop up in the cmd window. In that case, GLHF!

If there is an error again which gives you a value of 1, additional setting up is required on your android device.

> MAIN ERROR persists(, CMD output slightly different, now gives a value of 1)

2.b.1. Check connection medium
First make sure the USB-cable is properly connected and a connection can be established. Set the connection on your android device to file transfer. If you can read (and write) files with your windows on the device, there should be nothing wrong with this method of connection.

2.b.2. Set connection to MIDI
Set the connection to MIDI (at least for me MIDI works, USB-tethering does not, you might want to fiddle with this later on but leave it on MIDI for now).

2.b.3. Enter developer mode on device
On your device go to settings>About this phone>Software info and look for build number. Tap it seven times and you should be prompted to enter your pin/password/etc. in order to enter developer mode on your device.

2.b.4. Enable USB-troubleshooting
Now in developer mode, you should be able to scroll down the settings and find a section called something like developer options. In this section, find USB-troubleshooting or something similar. You might be prompted on either your laptop or phone or not.

In any case, that resolved the issue for me. I tried to write up the steps I took as clearly as possible. I hope it helps other people getting this fantastic script to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants