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

Issue with device.sync.push Resulting in AdbError: FAIL #101

Closed
songyuc opened this issue Jan 12, 2024 · 3 comments
Closed

Issue with device.sync.push Resulting in AdbError: FAIL #101

songyuc opened this issue Jan 12, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@songyuc
Copy link

songyuc commented Jan 12, 2024

Hello, guys,

I've encountered an issue with adbutils while working on a script that involves pushing a file to an Android emulator. The specific method that's causing trouble is device.sync.push. Despite successful execution of the same command via os.system(), the device.sync.push method results in an AdbError: FAIL exception.

Environment:

  • adbutils version: 1.2.15
  • Operating System: Windows 10
  • Python Version: 3.11.5

Issue Description:
The script is intended to clone the minitouch repo, build it, and then push the minitouch binary to an emulator. The os.system() method successfully pushes the file using the adb push command. However, when attempting to do the same with adbutils, it results in an error.

Here is the relevant part of the script:

# ... [Previous code for context]

print(minitouch_path / "libs" / abi / "minitouch")
os.system(r"adb push D:\Program\xxx\Python_emutouch\minitouch\libs\x86_64\minitouch /data/local/tmp/")
device.sync.push(minitouch_path / "libs" / abi / "minitouch", "/data/local/tmp/", check=True)

# ... [Rest of the code]

The error encountered is as follows:

adbutils.errors.AdbError: FAIL

Attempts to Resolve:

  • Confirmed that the file path is correct and the file exists.
  • Checked the device connection and ensured it is stable.
  • Tried simplifying the code to isolate the issue.

I'm unsure why device.sync.push is failing while os.system() succeeds. Any insights or suggestions would be greatly appreciated.

Thank you for your time and assistance.

Best regards,
Yucheng Song

@codeskyblue
Copy link
Member

Change the destination to /data/local/tmp/minitouch

@songyuc
Copy link
Author

songyuc commented Jan 15, 2024

Hi, @codeskyblue, thanks sincerely for your guide!

Besides, I'd like to suggest an enhancement for the device.sync.push() method to align more closely with the standard adb push command behavior.

In standard ADB, the command adb push source-path destination-path automatically retains the source file name if the destination file name is not specified. For example, adb push xxx\minitouch\libs\x86_64\minitouch /data/local/tmp/ pushes the file to /data/local/tmp/minitouch.

It would be highly beneficial if adbutils could adopt similar functionality, as following example:

# os.system(r"adb push xxx\minitouch\libs\x86_64\minitouch /data/local/tmp/")
device.sync.push(minitouch_path / "libs" / abi / "minitouch", "/data/local/tmp/", check=True)

This change of omitting the target file name would allow users to push files without specifying the file name in the destination path, thus simplifying the command and making the API more intuitive, especially for those accustomed to the standard ADB behavior.

Thank you for considering this suggestion.

Best regards,
Yucheng Song

@shidalao
Copy link

change your dst directory to a specific file name, such as "/data/local/tmp/" to "/data/local/tmp/123.txt"

@codeskyblue codeskyblue added the enhancement New feature or request label May 1, 2024
@codeskyblue codeskyblue self-assigned this May 1, 2024
codeskyblue added a commit that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants