Hi Ram & Ravi
I am getting same problem and unable to launch android application.
I have tried all the methods and get nothing on any blog or anywhere.
Please see my logs and code and help me out.. i am totally stucked and very new to Appium
Appium Logs:
info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\Appium\Whatsapp\WhatsApp.apk","appPackage":"com.whatsapp","appActivity":"com.whatsapp.Main","platformVersion":"6.0","browserName":"","platformName":"Android","deviceName":"Mi498HA14090346"}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_66)
info: [debug] Using local app from desired caps: D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] Creating new appium session 9bf0c62d-b4ac-454a-938b-dfc46b4e9afc
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_66
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\Cherrey\sdk\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device sp7731c21005c070464
info: [debug] Setting device id to sp7731c21005c070464
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 wait-for-device
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 23
info: Device API level is: 23
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language:
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\Appium\Whatsapp\WhatsApp.apk" "C:\Users\RISHAB~1.JAI\AppData\Local\Temp\com.whatsapp"
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 push "C:\Users\RISHAB~1.JAI\AppData\Local\Temp\com.whatsapp\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from D:\Cherrey\sdk\build-tools\android-4.4W\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: D:\Cherrey\sdk\build-tools\android-4.4W\aapt.exe dump xmltree D:\Appium\Whatsapp\WhatsApp.apk AndroidManifest.xml
info: [debug] Set app process to: com.whatsapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for D:\Appium\Whatsapp\WhatsApp.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] App already signed.
info: [debug] Zip-aligning D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from D:\Cherrey\sdk\build-tools\android-4.4W\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: D:\Cherrey\sdk\build-tools\android-4.4W\zipalign.exe -f 4 D:\Appium\Whatsapp\WhatsApp.apk C:\Users\RISHAB~1.JAI\AppData\Local\Temp\116112-15112-nqoy3v\appium.tmp
info: [debug] MD5 for app is 4fb3cc813bcf5837bf8e009648edebd9
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "ls /data/local/tmp/4fb3cc813bcf5837bf8e009648edebd9.apk"
info: [debug] Getting install status for com.whatsapp
info: [debug] Getting device API level
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 23
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "pm list packages -3 com.whatsapp"
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "am force-stop com.whatsapp"
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell "pm clear com.whatsapp"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c \"D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"\n)","killed":false,"code":3221226356,"signal":null,"cmd":"C:\Windows\system32\cmd.exe /s /c \"D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"","origValue":"Command failed: C:\Windows\system32\cmd.exe /s /c \"D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install \"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk\"\"\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 24140.098 ms - 862
Code:
private static AndroidDriver driver = null;
public static void main(String g[]) throws MalformedURLException,InterruptedException
{
File app = new File("D://Appium//Whatsapp//WhatsApp.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.BROWSER_NAME, "");
cap.setCapability("deviceName", "Mi498HA14090346");
cap.setCapability("platformName", "Android");
//cap.setCapability("automationName", "android-app");
cap.setCapability("platformVersion", "6.0");
cap.setCapability("app", app.getAbsolutePath());
cap.setCapability("appPackage", "com.whatsapp");
cap.setCapability("appActivity", "com.whatsapp.Main");
//driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
String host = "127.0.0.1";
String port = "4723";
try {
driver = new AndroidDriver(
new URL("http://" + host + ":" + port + "/wd/hub"),
cap);
}
catch(Exception e) {
}
System.out.println("APP Launched");
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(10000);
driver.quit();