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

adb install form URl fails #142

Open
rob-X1 opened this issue Sep 2, 2024 · 1 comment
Open

adb install form URl fails #142

rob-X1 opened this issue Sep 2, 2024 · 1 comment

Comments

@rob-X1
Copy link

rob-X1 commented Sep 2, 2024

This is a simple example installing a small clock app from F-Droid store downloaded and installed from an URL:

import adbutils

adb = adbutils.AdbClient(host="127.0.0.1", port=5037)
print(adb.device_list())
d = adb.device()
d.install("https://f-droid.org/repo/com.chancehorizon.just24hoursplus_10401.apk")

Based on the log file it seems to download the APK to /data/local/tmp on the Android phone, but when the download has finished it tries to install the APK from a tmp file on the PC:

"C:\Program Files\Python311\python.exe" adb_install.py 
[AdbDevice(serial=91121EEHN13855)]
tmpfile path: C:\Users\user\AppData\Local\Temp\tmpvl43azd8.apk
push to /data/local/tmp/tmp-1725282378118.apk
100.0%	4.9 MB/s [2.9 MB/2.9 MB]
100.0%	4.9 MB/s [2.9 MB/2.9 MB]
Traceback (most recent call last):
  File "C:\Temp\adb_install.py", line 6, in <module>
    d.install("https://f-droid.org/repo/com.chancehorizon.just24hoursplus_10401.apk")
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\retry\api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
           ^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\adbutils\install.py", line 90, in install
    package_name = apk.manifest.package_name
                   ^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\__init__.py", line 211, in manifest
    return Manifest(self.get_org_manifest())
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\__init__.py", line 180, in get_org_manifest
    self._init_manifest()
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\__init__.py", line 215, in _init_manifest
    self._init_org_manifest()
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\__init__.py", line 202, in _init_org_manifest
    raise e
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\__init__.py", line 192, in _init_org_manifest
    with apkfile.ZipFile(self.apk_path, mode="r") as zf:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\apkutils2\apkfile.py", line 1012, in __init__
    self.fp = io.open(file, filemode)
              ^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\tmpvl43azd8.apk'

Process finished with exit code 1

Tested on Windows 10 using adbutils 2.8.0.

@codeskyblue
Copy link
Member

yes, the logic is contains two steps.

  1. download to pc
  2. push apk from pc to android

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

2 participants