2016-10-11 192 views
0

我不能夠真正的Android設備上的機器人工作室和geeting以下錯誤連接或runb腳本:無法連接/運行Android設備上運行在Android Studio中

enter image description here

代碼如下: import org.junit.Before;

import java.net.URL; 

import org.junit.Before; 
import org.junit.Test; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.remote.CapabilityType; 
import org.openqa.selenium.remote.DesiredCapabilities; 
import org.openqa.selenium.remote.RemoteWebDriver; 

import io.appium.java_client.android.AndroidDriver; 

public class Sample { 

    private static RemoteWebDriver driver; 
    @Before 
    public void setUp() throws Exception { 
     DesiredCapabilities capabilities = new DesiredCapabilities(); 
     capabilities.setCapability("device","Android"); 
     capabilities.setCapability("app", "Chrome"); 
     capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); 
     capabilities.setCapability(CapabilityType.VERSION, "4.4.2"); 
     capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS"); 
     driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), 
       capabilities); 
    } 

    @Test 
    public void testcase_001() throws Exception{ 
     driver.get("http://www.google.com"); 

     WebElement keyword = driver.findElementByName("q"); 
     keyword.sendKeys("appium"); 
     driver.findElement(By.id("btnK")).click(); 
     Thread.sleep(5000); 
    } 
} 

但是該設備在Android裝置監視器

enter image description here

列出並示出爲連接在CMD

enter image description here

而東西,我試圖在改變下列設置:

  • Android studio>運行>編輯配置>在Gerenal選項卡>將目標設置爲USB DEVICE。

任何想法是錯誤的

回答

0

刪除最後一個APK,如果你已經安裝前,並嘗試安裝新的APK。

+0

沒有努力嘗試過,甚至試圖把一個新的.apk那裏。相同的結果 – Sandeep

+0

是否卸載了最後一個 –

+0

我認爲還有另一個具有相同文件的應用程序。這可能是問題。 –

相關問題