点击查看
持续@2018
欢迎技术交流@2018

Genymotion、 uiautomatorviewer、 appium报错

Genymotion模拟器启动时报错:

Unable to start the virtual device.The virtual device got no IP address.The VirtualBox DHCP server has not assigned an IP address to the virtual device.To find a solution,please start VirualBox.

解决办法:

 

1、以管理员身份运行Genymotion;

 我按照网上说的设置vm virtualBox的网络、网卡、DHCP等无效果,于是自己尝试启动虚拟机查看报错内容,发现是电脑未设置虚拟化导致的,而Genymotion却报的是网络问题,只能说考虑问题还是看根本靠谱些吧。

2、vm virtualBox正常启动该模拟器,查看具体报错信息

 

 

模拟器报的错:

 

 

 

 

进入电脑boss,设置虚拟化,后选择模拟器的版本,即可解决

 

 

 

 

 

 

 

Genymotion下载模拟器完成时,提示unable to create virtual device:failed to import ova file

1、以管理员身份运行Genymotion;

2、删除文件:

 

uiautomatorviewer.bat打开报错:

Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

解决办法:

关闭appium重新捕获app界面;

 

appium 1.4 使用desired_caps['unicodeKeyboard'] = True 会报错,是因为重复安装了UnicodeIME-debug.apk 报错如下:

selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "F:\xxx\android-sdk-windows\platform-tools\adb.exe -s P1QRMW6136 install "F:\xxx\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk""
Failed to install F:\xxx\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.android.ime without first uninstalling

解决办法:

cmd 可卸载adb install io.appium.android.ime

 

appium1.4 不支持android版本为7报错:

Attempt to re-install io.appium.settings without first uninstalling

解决办法:

 

解决方案:
1、修改C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js文件为下图

 

2、修改C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js文件为下图

 

this.shell_grep("ps", name, function (err, stdout) {
 
     if (err) {
 
     logger.debug("No matching processes found");
 
     return cb(null, []);
 
    }
 
ADB.prototype.shell_grep = function (cmd, grep, cb) {
 
    if (cmd.indexOf('"') === -1) {
    cmd = '"' + cmd + '"';
    }
 
   var execCmd = 'shell ' + cmd + '| grep ' + grep;
 
   this.exec(execCmd, cb);
 
   };

 

 

appium 运行脚本,启动应用,弹出权限或其他弹出框:

解决办法:

 

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
# 判断是否有权限弹窗,根据关键字来确定
for i in range(5):
    alertWin = ("xpath", "//*[@text='去授权']")
    try:
        e = WebDriverWait(driver, 1, 0.5).until(EC.presence_of_element_located(alertWin ))
        e.click()
    except:
        pass

 

 

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000

解决办法:

  检查Activity是否写错,self.desired_caps['appActivity'] = 'com.xxx.xxx'

 

Genymotion安装app报错,模拟器无法拖拉安装  和 Genymotion "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE" errors; INSTALL_FAILED_NO_MATCHING_ABIS

解决办法:

  下载Genymotion-ARM-Translation_v1.1.zip;下载地址

  cmd安装命令:

    adb push  C:\Users\AS\Downloads\Genymotion-ARM-Translation_v1.1.zip   /sdcard/Download

    adb shell sh /system/bin/flash-archive.sh /sdcard/Download/Genymotion-ARM-Translation_v1.1.zip

  关闭模拟器,重启模拟器即可

 

@成为那个自己
posted @ 2018-08-15 21:24  小姐姐1024  阅读(1040)  评论(0编辑  收藏  举报