使用appium1.8 ,启动app过程中报错:
2018-05-08 17:09:16:890 - [W3C] Encountered internal error running command: Error: [100%] /data/local/tmp/UnicodeIME-debug.apk
2018-05-08 17:09:16:890 - [W3C] /usr/local/lib/node_modules/appium/node_modules/_appium-android-ime@2.0.0@appium-android-ime/bin/UnicodeIME-debug.apk: 1 file pushed. 4.5 MB/s (36795 bytes in 0.008s)
2018-05-08 17:09:16:890 - [W3C] pkg: /data/local/tmp/UnicodeIME-debug.apk
2018-05-08 17:09:16:891 - [W3C] Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
2018-05-08 17:09:16:893 - [W3C] at ADB.executeInstall$ (/usr/local/lib/node_modules/appium/node_modules/_appium-adb@6.9.2@appium-adb/lib/tools/apk-utils.js:398:13)
2018-05-08 17:09:16:893 - [W3C] at tryCatch (/usr/local/lib/node_modules/appium/node_modules/_babel-runtime@5.8.24@babel-runtime/regenerator/runtime.js:67:40)
2018-05-08 17:09:16:894 - [W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/_babel-runtime@5.8.24@babel-runtime/regenerator/runtime.js:315:22)
2018-05-08 17:09:16:894 - [W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/_babel-runtime@5.8.24@babel-runtime/regenerator/runtime.js:100:21)
2018-05-08 17:09:16:894 - [W3C] at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/_babel-runtime@5.8.24@babel-runtime/regenerator/runtime.js:136:37)
2018-05-08 17:09:16:894 - [W3C] at <anonymous>
2018-05-08 17:09:16:895 - [HTTP] <-- POST /wd/hub/session 500 5747 ms - 1834
按照提示,实在按装apk时报错,apk位置。/usr/local/lib/node_modules/appium/node_modules/_appium-android-ime@2.0.0@appium-android-ime/bin/UnicodeIME-debug.apk
报错:INSTALL_FAILED_UPDATE_INCOMPATIBLE
这个提示原因是签名发生改变,看样子是升级到appium 1.8 。而手机以前安装过这个app,签名不一致导致的。在手机界面一时也找不到这个app来协助。就只有通过安装adb 命令来卸载这个app。命令卸载要知道这个app的包名,包名可以通过aapt命令查询。而aapt 命令在ANDROID_HOME目录下的 build-tools/27.0.3/目录中,可以把这个命令拷贝到ANDROID_HOME/tools/目录下,这样就不会提示 aapt command not found。找到appt命令,就可以获取apk的报名了
执行命令:aapt dump badging /usr/local/lib/node_modules/appium/node_modules/_appium-android-ime@2.0.0@appium-android-ime/bin/UnicodeIME-debug.apk
可以看到第一行
package: name='io.appium.android.ime' versionCode='1' versionName='1.0' platformBuildVersionName='4.4.2-1456859'
其中 的io.appium.android.ime就是包名
执行adb uninstall io.appium.android.ime 删除这个应用后再执行安装
adb install /usr/local/lib/node_modules/appium/node_modules/_appium-android-ime@2.0.0@appium-android-ime/bin/UnicodeIME-debug.apk 就可以安装成功,appium 就可以再继续正常运行了