I am new in mobile automation and first time trying to launch the app in emulator. Just the mobile screen blinks but My app doesn’t get launched. Can anyone help me..
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class AppTest {
public static AppiumDriver<MobileElement>appium;
public static void main(String[] args) {
// TODO Auto-generated method stub
File app = new File(“C:\Users\User\Desktop\iTest-20.07(43).apk”);
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
caps.setCapability(“deviceName”,”emulator-5554″);
caps.setCapability(“platformName”, “Android”);
caps.setCapability(“platformVersion”, “8.0”);
caps.setCapability(“appPackage”, “com.google.android.apps.nexuslaunch”);
caps.setCapability(“appActivity”, “com.google.android.apps.nexuslaunch.NexusLaunchActivity”);
caps.setCapability(“noReset”, “false”);
caps.setCapability(“disableWindowAnimation”, false);
try {
appium = new AndroidDriver<MobileElement>(new URL(“http://0.0.0.0:4723/wd/hub”), caps);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(“Application Launched”);
}
}
Result:
io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
Source: Read More