Skip to content

Commit

Permalink
If the installation of Yosemite.apk fails, but the phone has an old v…
Browse files Browse the repository at this point in the history
…ersion, the installation is not mandatory

(cherry picked from commit 1bb17d4)
(cherry picked from commit 90d9eb2)
  • Loading branch information
yimelia committed Feb 3, 2021
1 parent 1b85fc7 commit b1c8568
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion airtest/core/android/yosemite.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def _install_apk_upgrade(self, apk_path, package):
installed_version = self.adb.get_package_version(package)
LOGGING.info("local version code is {}, installed version code is {}".format(apk_version, installed_version))
if installed_version is None or apk_version > int(installed_version):
self.adb.install_app(apk_path, replace=True, install_options=["-t", "-g"])
try:
self.adb.install_app(apk_path, replace=True, install_options=["-t", "-g"])
except:
if installed_version is None:
raise
# If the installation fails, but the phone has an old version, do not force the installation
LOGGING.error("Yosemite.apk update failed, please try to reinstall manually.")

@on_method_ready('install_or_upgrade')
def get_ready(self):
Expand Down

0 comments on commit b1c8568

Please sign in to comment.