接上文:
安装完成后要进行一下简单修改:
(1)、打开安装目录,进入到bin目录(比如:D:Noxin)
(2)、把安装好的Android SDK里的adb.exe文件(比如我的在D:AndroidSDKplatform-tools目录下)复制到该目录覆盖掉该目录已存在的adb.exe文件
(3)、删掉该目录的nox_adb.exe文件,再复制一份adb.exe并重命名为nox_adb.exe
(4)、启动模拟器
===========================================================================
确认夜神模拟器是否启动成功:
================================================================================
package jkcs; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.AppiumDriver; public class jblx { public static void main(String[] args) throws MalformedURLException, InterruptedException { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName","127.0.0.1:62001"); capabilities.setCapability("platformVersion", "5.1.1"); capabilities.setCapability("appPackage", "com.youdao.calculator"); capabilities.setCapability("appActivity", "com.youdao.calculator.activities.MainActivity"); AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); Thread.sleep(5000); System.out.println(driver.currentActivity()); Thread.sleep(5000); System.out.println(driver.getCapabilities()); Thread.sleep(5000); driver.quit(); } }
执行结果:
.activities.GuideActivity
Capabilities [{appPackage=com.youdao.calculator, deviceScreenSize=720x1280, networkConnectionEnabled=true, statBarHeight=38, warnings={}, viewportRect={top=38, left=0, width=720, height=1242}, databaseEnabled=false,
deviceName=127.0.0.1:62001,
platform=LINUX,
deviceUDID=127.0.0.1:62001,
appActivity=com.youdao.calculator.activities.MainActivity,
desired={appPackage=com.youdao.calculator,
appActivity=com.youdao.calculator.activities.MainActivity,
platformVersion=5.1.1,
platformName=Android,
deviceName=127.0.0.1:62001},
platformVersion=5.1.1,
pixelRatio=1.5,
webStorageEnabled=false,
locationContextEnabled=false,
takesScreenshot=true,
javascriptEnabled=true,
deviceScreenDensity=240,
deviceModel=MI 9,
platformName=Android,
deviceApiLevel=22,
deviceManufacturer=Xiaomi
}]