xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.03k stars 643 forks source link

apk files cannot be installed on Android version 4.2 #171

Open truebit opened 8 years ago

truebit commented 8 years ago

$ ls -al /usr/local/lib/python2.7/site-packages/uiautomator/libs -rw-r--r-- 1 foobar admin 1239378 7 5 18:10 app-uiautomator-test.apk -rw-r--r-- 1 foobar admin 1523739 7 5 18:10 app-uiautomator.apk -rw-r--r-- 1 foobar admin 461493 7 5 18:10 bundle.jar -rw-r--r-- 1 foobar admin 34104 7 5 18:10 uiautomator-stub.jar $ adb install -rt app-uiautomator-test.apk [100%] /data/local/tmp/app-uiautomator-test.apk pkg: /data/local/tmp/app-uiautomator-test.apk

command would stuck here on Xiaomi Redmi 1 with version 4.2.1 HM2013022 On device it would display below error: package parse error

2016-07-06 12 24 19

app-uiautomator.apk has the same problem.

Tried on another Android 4.2.1 device, adb command returned

Failure [INSTALL_FAILED_OLDER_SDK]

I guess you are using UiAutomator2, which only supports API level 18 and later. Maybe you should make it clear in README

truebit commented 8 years ago

in Python, it would throw RPC server not started! error. It took time to locate the real problem. I think the error should be more precise when executing system commands. add some polling and exit code check would be much better

hongbinbao commented 8 years ago

@truebit what's your SDK level? 4.2.x should be SDK level 17.

Device with SDK level < 18 should push bundle.jar/uiautomator-stub.jar to device side.

truebit commented 8 years ago

yep, these files were pushed to device. but python-uiautomator seems not invoking them

hongbinbao commented 8 years ago

@truebit May be you have not the latest release of python uiautomator

uiautomator - Python Wrapper for Android UiAutomator test tool INSTALLED: 0.2.6 (latest)

truebit commented 8 years ago

Of course I installed the latest one... anyway I gave up uiautomator py and wrote a native uiautomator jar to fulfill my requirements.