Appium (Android): App not signed with debug cert - java
I was running my automation scripts on bamboo using below configuration and facing an issue while re-signing the app file on simulator. I have tried what I can but couldn't say what's the issue with, is it appium, or bamboo or emulator issue?
Earlier then this issue, I faced an issue same as in the below link. I have tried to solve that issue and started facing this issue.I have raised this issue in Appium discuss also.
Here is the link: https://discuss.appium.io/t/uiautomator2-error-cannot-read-property-isscreenlocked-of-undefined/15153
Appium: appium#1.6.4-beta and also tried with appium#1.6.3
jdk: 1.8.0_102
platformVersion: '7.1'
automationName: 'uiautomator2'
platformName: 'Android'
Logs:
[Appium] Welcome to Appium v1.6.3
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"apk-path","newCommandTimeout":"600","platformVersion":"7.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"apk-path","newCommandTimeout":"600","platformVersion":"7.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554"},null,null,null,null]
[Appium] Creating new AndroidUiautomator2Driver session
[Appium] Capabilities:
[Appium] app: 'apk-path'
[Appium] newCommandTimeout: '600'
[Appium] platformVersion: '7.1'
[Appium] automationName: 'uiautomator2'
[Appium] platformName: 'Android'
[Appium] deviceName: 'emulator-5554'
[BaseDriver] Capability 'newCommandTimeout' changed from string ('600') to integer (600). This may cause unexpected behavior
[BaseDriver] Session created with session id: 25e878b1-f9cf-4fb5-9070-d88617c91374
[BaseDriver] Using local app 'apk-path'
[debug] [UiAutomator2] Checking whether app is actually present
[UiAutomator2] UIAutomator2 Driver version:0.2.3
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_102
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/admin/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1'
[debug] [ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/admin/Library/Android/sdk/platform-tools/adb
[debug] [ADB] Setting device id to emulator-5554
[debug] [AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/admin/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[debug] [ADB] badging package: package
[debug] [ADB] badging act: Activity
[debug] [AndroidDriver] Parsed package and activity are: package/Activity
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[debug] [ADB] Attempting to kill all io.appium.uiautomator2.server processes
[debug] [ADB] Getting all processes with io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","ps"]
[ADB] No io.appium.uiautomator2.server process found to kill, continuing...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk"]
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk"]
[debug] [ADB] Application '/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk' already installed. Continuing.
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[debug] [ADB] Application '/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","forward","tcp:8200","tcp:6790"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [AndroidDriver] Extracting strings from apk apk-path null /var/folders/w3/85v473ln4n795wf2dd39mgjw0000gn/T/package
[debug] [ADB] Extracting strings for language: default
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[debug] [ADB] Device API level: 25
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","persist.sys.locale"]
[debug] [ADB] Current device property 'persist.sys.locale':
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.locale"]
[debug] [ADB] Current device property 'ro.product.locale': en-US
[debug] [ADB] No strings.xml for language 'en', getting default strings.xml
[debug] [ADB] Reading strings from converted strings.json
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","push","/var/folders/w3/85v473ln4n795wf2dd39mgjw0000gn/T/package/strings.json","/data/local/tmp"]
[debug] [ADB] Checking app cert for apk-path.
[debug] [ADB] App not signed with debug cert.
[debug] [ADB] Resigning apk.
[ADB] Error: Could not sign with default ceritficate. Original error Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java -jar /usr/local/lib/node_modules/appium/node_modules/appium-adb/jars/sign.jar apk-path --override' exited with code 1
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-signing.js:21:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:108:47)
at /usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:119:28
at flush (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
at combinedTickCallback (internal/process/nexttick.js:67:7)
at process.tickCallback (internal/process/nexttick.js:98:9)
[Error: Could not sign with default ceritficate. Original error Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java -jar /usr/local/lib/node_modules/appium/node_modules/appium-adb/jars/sign.jar apk-path --override' exited with code 1]
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","package"]
Could someone help me on this please?
Thanks
I'm running into the same problem. I was told to reset the factory settings on my Samsung Galaxy S8! That did not work. I've read that it's a network timeout so increase the network time out. I see you added newCommandTimeout: '600' I did the same and that did not work.
Did you have an older version of Appium running? I tried with the Windows U/I version 1.4.16! and then I tried with the beta version of the Windows U/I. I finally removed the U/I version and installed the commandline version 1.6.5. I still run into the same problem.
While running the scripts I was running using command line without providing automation name "uiautomator2" and the scripts started working for me. I really don't understand where the issue was exactly till now, as it is working fine I didn't concentrate on the issue again.
Hope this helps for you.
Thanks
Related
Can't start appium inspector session: exited with code 255
I am trying to start an appium inspector session, however I keep having problems with apkanalyzer.bat, now I received the following message: Using 'apkanalyzer.bat' from 'C:\Users\ayla_\AppData\Local\Android\Sdk\tools\bin\apkanalyzer.bat' [ADB] Starting 'C:\Users\ayla_\AppData\Local\Android\Sdk\tools\bin\apkanalyzer.bat' with args ["-h","manifest","print","C:\\Users\\ayla_\\Documents\\Documentos_Ayla\\Treinamentos\\Automacao Mobile\\File Manager by Astro File Browser_v7.4.0_apkpure.com.apk"] [ADB] Using the alternative activity name detection method because of: Command 'C\:\\Users\\ayla_\\AppData\\Local\\Android\\Sdk\\tools\\bin\\apkanalyzer.bat -h manifest print 'C:\\Users\\ayla_\\Documents\\Documentos_Ayla\\Treinamentos\\Automacao Mobile\\File Manager by Astro File Browser_v7.4.0_apkpure.com.apk'' exited with code 255 [ADB] Extracting package and launch activity from manifest [AndroidDriver] Shutting down Android driver [AndroidDriver] Called deleteSession but bootstrap wasn't active [Logcat] Stopping logcat capture [ADB] Running 'C:\Users\ayla_\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop io.appium.unlock' [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted. [BaseDriver] Event 'newSessionStarted' logged at 1569549028506 (22:50:28 GMT-0300 (Hora oficial do Brasil)) [MJSONWP] Encountered internal error running command: Error: packageAndLaunchActivityFromManifest failed. Original error: Command 'java -jar C\:\\Users\\ayla_\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\jars\\appium_apk_tools.jar printLaunchActivity 'C:\\Users\\ayla_\\Documents\\Documentos_Ayla\\Treinamentos\\Automacao Mobile\\File Manager by Astro File Browser_v7.4.0_apkpure.com.apk' C\:\\Users\\ayla_\\AppData\\Local\\Temp\\com.metago.astro' exited with code 1; StdErr: Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f060046 color/common_google_signin_btn_text_dark_default, config=[DEFAULT] If someone knows the solution to this problem, please share with me.
Getting A new session could not be created
Can anyone help me out I am new to Android testing with Appium , I am trying to open app in AVD the app getting installed but then m getting Error "A new Session could not be created.(Original error: Command failed: )","killed":false,"code":1,"signal":null,"origValue":"Command failed: "},"sessionId":null} Thanks for the help in advance tried with just giving capabilities.setCapability("appActivity", ".MainActivity"); ''' File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "/Apps/src/"); File app = new File(appDir, "ChatApp-release.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("deviceName", "emulator-5554"); capabilities.setCapability("platformVersion", "7.1.1"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", "com.aaa.charla"); capabilities.setCapability("appActivity", "com.aaa.xxx.MainActivity"); driver = new AndroidDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); Thread.sleep(10000); driver.quit(); Following are the Debug log: info: Console LogLevel: debug info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk","appPackage":"com.odysseyinc.charla","appActivity":"com.odyssey.chatapp.MainActivity","newCommandTimeout":"10000","platformName":"Android","version":"7.1.1","deviceName":"emulator-5554"}} info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_162) info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version info: [debug] Using local app from desired caps: D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk info: [debug] Creating new appium session 0d25aeac-d055-449f-af84-b6d314d9b4a5 info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_162 info: [debug] Checking whether adb is present info: [debug] Using adb from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.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: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe devices info: [debug] 1 device(s) connected info: Found device emulator-5554 info: [debug] Setting device id to emulator-5554 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 25 info: Device API level is: 25 info: [debug] Extracting strings for language: default info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 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:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk" "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla" info: [debug] Reading strings from converted strings.json info: [debug] Setting language to default info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla\strings.json" /data/local/tmp info: [debug] Checking whether aapt is present info: [debug] Using aapt from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe info: [debug] Retrieving process from manifest. info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe dump xmltree D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk AndroidManifest.xml info: [debug] Set app process to: com.odysseyinc.charla info: [debug] Not uninstalling app since server not started with --full-reset info: [debug] Checking app cert for D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk. info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk info: [debug] App already signed. info: [debug] Zip-aligning D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk info: [debug] Checking whether zipalign is present info: [debug] Using zipalign from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe info: [debug] Zip-aligning apk. info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe -f 4 D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk C:\Users\UNMESH~1.GHA\AppData\Local\Temp\119427-15556-1rmbgw9\appium.tmp info: [debug] MD5 for app is f3d7efc8b197792c3d0529a48dc92ff2 info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/f3d7efc8b197792c3d0529a48dc92ff2.apk" info: [debug] Getting install status for com.odysseyinc.charla info: [debug] Getting device API level info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 25 info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm list packages -3 com.odysseyinc.charla" info: [debug] App is installed info: App is already installed, resetting app info: [debug] Running fast reset (stop and clear) info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "am force-stop com.odysseyinc.charla" info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm clear com.odysseyinc.charla" info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device... info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 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: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 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 error: Failed to start an Appium session, err was: Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.] info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session info: [debug] Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.] at ChildProcess.exithandler (child_process.js:637:15) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5) info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n)","killed":false,"code":1,"signal":null,"origValue":"Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n"},"sessionId":null} info: <-- POST /wd/hub/session 500 32039.992 ms - 664 `
You need to share the full appium logs in order to know the reason for that. [After checking the logs] That's a known issue for that specific Android image as it installs 2 versions of appium settings app and unlock app. What you can do is either change the android image you are testing against or uninstall those 2 apps before starting your script. You can uninstall them manually by starting the emulator GUI and do that with the mouse or through the below commands: adb -s device_serial uninstall io.appium.settings adb -s device_serial uninstall io.appium.unlock Also, you can add those commands in your code if you really have to execute the tests on android 7 devices as below: String androidVersion=executeCommand("adb shell getprop ro.build.version.release"); if(androidVersion.contains("7")) { //uninstall appium settings app cmd="adb uninstall io.appium.settings"; executeCommand(cmd); //uninstall appium unlock app cmd="adb uninstall io.appium.unlock"; executeCommand(cmd); }
I have upgraded the Appuim 1.4 to 1.9 and started working as Expected .
Appium: custom android app keeps crashing on launch
Have a problem where all of a sudden a previously working appium based android app selenium test has stopped working as it did (consistently successful). The issue is specifically to do with the launch of the app by appium (the app always launches when opened with physical user input..). Basically the app launches, the loading screen appears and then it crashes. This happens most of the time but not always. I've found it usually works fine initially after restarting the phone. However, it'll crash on subsequent runs. Any assistance would be much appreciated. Tried many things/searching online already but it's all been to of no avail.. Here's the appium output: [AndroidDriver] Parsed pid: '27608' pkg: 'com.dedsert.betbright.uat' from [AndroidDriver] USER PID PPID VSIZE RSS WCHAN PC NAME [AndroidDriver] u0_a236 27608 4736 3621124 393160 0 0000000000 R com.dedsert.betbright.uat [AndroidDriver] Returning process name: 'com.dedsert.betbright.uat' [AndroidDriver] Found webviews: ["WEBVIEW_com.dedsert.betbright.uat"] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.dedsert.betbright.uat"] [MJSONWP] Responding to client with driver.setContext() result: null [HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 200 245 ms - 76 [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.StackOverflowError [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: longMsg=stack size 1037KB [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_CODE: 0 [UiAutomator] UiAutomator exited unexpectedly with code 4294967295, signal null [UiAutomator] Moving to state 'stopped' [AndroidDriver] Shutting down Android driver [Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly' [Appium] Removing session a9457315-d657-4fd1-bdf0-36fe5d76b3c5 from our master session list [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","com.dedsert.betbright.uat"] [ADB] Pressing the HOME button [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","input","keyevent",3] [AndroidBootstrap] Cannot shut down Android bootstrap; it has already shut down [Logcat] Stopping logcat capture [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","io.appium.unlock"] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted. [HTTP] --> POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context {"name":"WEBVIEW_com.dedsert.betbright.uat"} [HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 404 1 ms - 131 Not a whole lot to be seen on the IntelliJ side - did spot this in the stacktrace given: org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 5 milliseconds
Uninstall appium and reinstall appium and it will work for you. From command line. npm uninstall -g appium Reinstall the appium. npm install -g appium
Looks like your phone is out of memory. It could be worthwhile to clear the cache of your testing phone : Power off your device. This method is different for different manufacturers, and you should look it up on the internet before proceeding further. Load into your bootloader screen by holding down a combination of keys. In some devices, you have to press the Power button with Volume down key simultaneously. In other devices, Power button with both the Volume keys have to pressed simultaneously. Touchscreen might not work, and you have to navigate using Volume keys. Go to Recovery and select it with a tap on the Power button. Go to Wipe cache partition and tap the Power button to select it. After the cache gets cleared, select Reboot system now. Information from (step 4): https://fossbytes.com/clear-android-cache-data-quick-methods/
Appium scripts are getting failed, after hitting url successful
Appium scripts are getting failed, after hitting url successful. Selenium Oxygen 2 Appium version 1.2.7 Url hit the browser open the link, after some page gates refreshed and then again url reopened in new tab within the same chrome browser. url " us.justdial.com" opeing in the chrome browser still scripts are getting failed. Have already updated chrome driver. Below are the scripts import java.net.MalformedURLException; import java.net.URL; //import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit; /*import org.openqa.selenium.Capabilities; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver.Timeouts; import org.openqa.selenium.chrome.ChromeDriver;*/ //import org.openqa.selenium.android.AndroidDriver; //import org.openqa.selenium.remote.BrowserType; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; //import org.openqa.selenium.remote.RemoteWebDriver; //import org.openqa.selenium.remote.RemoteWebDriver; //import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; //import io.appium.java_client.remote.MobileCapabilityType; public class Appium_device { //String driverPath = "F:/ChromeDriver/chromedriver.exe"; public AppiumDriver driver; #Test public void Appium_device() throws MalformedURLException, Exception { { // APPLICATION_LOG.info("Initializing project properties"); DesiredCapabilities capabilities = new DesiredCapabilities(); // Set android deviceName desired capability. Set your device name. // capabilities.setCapability("deviceName", "5203a1bbea4a8385"); // capabilities.setCapability("deviceName", "4100df0accbd9f00"); // capabilities.setCapability("deviceName", "0123456789ABCDEF"); capabilities.setCapability("deviceName", "4d007af54ac04177"); // Set BROWSER_NAME desired capability. It's Android in our case here. capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android"); // capabilities.setCapability("browsername", "chrome"); capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe"); // Set android VERSION desired capability. Set your mobile device's OS version. // capabilities.setCapability(CapabilityType.VERSION, "4.2.2"); // capabilities.setCapability(CapabilityType.VERSION, "6.0.1"); capabilities.setCapability(CapabilityType.VERSION, "6.0.1"); // Set android platformName desired capability. It's Android in our case here. capabilities.setCapability("platformName", "Android"); // Set android appPackage desired capability. It is // com.android.calculator2 for calculator application. // Set your application's appPackage if you are using any other app. // capabilities.setCapability("appPackage", "org.mozilla.firefox"); capabilities.setCapability("appPackage", "com.android.chrome"); // Set android appActivity desired capability. It is // com.android.calculator2.Calculator for calculator application. // Set your application's appPackage if you are using any other app. capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main"); // Created object of RemoteWebDriver will all set capabilities. // Set appium server address and port number in URL string. // It will launch calculator app in android device. // webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe'); // RemoteWebDriver webDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); // webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); try { driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities); }catch(MalformedURLException e) { e.printStackTrace(); } driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); System.out.println("Step 9"); try { driver.get("https://us.justdial.com"); System.out.println("site hit"); } catch (Exception e) { System.out.println("site not accessed"); throw (e); // TODO: handle exception } } } } Following are the appium error logs [Appium] Welcome to Appium v1.7.1 [Appium] Non-default server args: [Appium] address: 127.0.0.1 [Appium] Appium REST http interface listener started on 127.0.0.1:4723 [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"capabilities":{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}} [MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},null,{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1515140901130 (13:58:21 GMT+0530 (India Standard Time)) [Appium] Creating new AndroidDriver (v1.28.1) session [Appium] Capabilities: [Appium] appActivity: 'com.google.android.apps.chrome.Main' [Appium] appPackage: 'com.android.chrome' [Appium] browserName: 'Android' [Appium] chromedriverExecutable: 'C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe' [Appium] deviceName: '4d007af54ac04177' [Appium] platformName: 'Android' [Appium] version: '6.0.1' [BaseDriver] The following capabilities were provided, but are not recognized by appium: version. [BaseDriver] Session created with session id: b284c843-d3e4-4d13-94aa-a9f752377fe8 [AndroidDriver] Getting Java version [AndroidDriver] Java version is: 1.8.0_144 [ADB] Checking whether adb is present [ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] 1 device(s) connected [AndroidDriver] Using device: 4d007af54ac04177 [ADB] Checking whether adb is present [ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe [ADB] Setting device id to 4d007af54ac04177 [AndroidDriver] App file was not listed, instead we're going to run com.android.chrome directly on the device [AndroidDriver] Checking whether package is present on the device [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","com.android.chrome"] [AndroidDriver] Starting Android session [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","wait-for-device"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","echo","ping"] [Logcat] Starting logcat capture [AndroidDriver] Pushing settings apk to device... [ADB] Uninstalling and re-installing 'io.appium.settings' [ADB] Uninstalling io.appium.settings [ADB] Getting install status for io.appium.settings [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"] [ADB] App is installed [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","io.appium.settings"] [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","uninstall","io.appium.settings"] [ADB] ADB command output: Success [ADB] io.appium.settings was successfully uninstalled [ADB] Getting install status for io.appium.settings [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"] [ADB] App is not installed [ADB] App 'C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' not installed. Installing [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\app\\build\\outputs\\apk\\settings_apk-debug.apk"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.sdk"] [ADB] Current device property 'ro.build.version.sdk': 23 [ADB] Device API level: 23 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","package","io.appium.settings"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","dump","io.appium.settings"] [ADB] Got the following command chunks to execute: pm,grant,io.appium.settings,android.permission.INTERNET,;,pm,grant,io.appium.settings,android.permission.CHANGE_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.READ_PHONE_STATE,;,pm,grant,io.appium.settings,android.permission.WRITE_SETTINGS,;,pm,grant,io.appium.settings,android.permission.CHANGE_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_FINE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_COARSE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_MOCK_LOCATION,;,pm,grant,io.appium.settings,android.permission.SET_ANIMATION_SCALE,; [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","grant","io.appium.settings","android.permission.INTERNET",";","pm","grant","io.appium.settings","android.permission.CHANGE_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.READ_PHONE_STATE",";","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.CHANGE_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_COARSE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";","pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"] [ADB] Device API level: 23 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","io.appium.settings/.Settings","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] [ADB] Device API level: 23 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","appops","set","io.appium.settings","android:mock_location","allow"] [AndroidDriver] Pushing unlock helper app to device... [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"] [ADB] Getting device platform version [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.release"] [ADB] Current device property 'ro.build.version.release': 6.0.1 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","wm","size"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.model"] [ADB] Current device property 'ro.product.model': SM-G900H [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.manufacturer"] [ADB] Current device property 'ro.product.manufacturer': samsung [AndroidDriver] No app sent in, not parsing package/activity [AndroidDriver] No app capability. Assuming it is already on the device [AndroidDriver] Running fast reset (stop and clear) [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","com.android.chrome"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","clear","com.android.chrome"] [AndroidBootstrap] Watching for bootstrap disconnect [ADB] Forwarding system: 4724 to device: 4724 [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","forward","tcp:4724","tcp:4724"] [UiAutomator] Starting UiAutomator [UiAutomator] Moving to state 'starting' [UiAutomator] Parsing uiautomator jar [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","push","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar","/data/local/tmp/"] [ADB] Attempting to kill all uiautomator processes [ADB] Getting all processes with uiautomator [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"] [ADB] No uiautomator process found to kill, continuing... [UiAutomator] Starting UIAutomator [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","4d007af54ac04177","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.chrome","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] Android bootstrap socket is now connected [ADB] Getting connected devices... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","window"] [AndroidDriver] Screen already unlocked, doing nothing [ADB] Device API level: 23 [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","com.android.chrome/com.google.android.apps.chrome.Main","-S"] [Appium] New AndroidDriver session created successfully, session b284c843-d3e4-4d13-94aa-a9f752377fe8 added to master session list [BaseDriver] Event 'newSessionStarted' logged at 1515140936767 (13:58:56 GMT+0530 (India Standard Time)) [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1","deviceUDID":"4d007af54ac04177","platformVersion":"6.0.1","deviceScreenSize":"1080x1920","deviceModel":"SM-G900H","deviceManufacturer":"samsung"} [HTTP] <-- POST /wd/hub/session 200 35735 ms - 978 [HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts {"type":"implicit","ms":10000} [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"b284c843-d3e4-4d13-94aa-a9f752377fe8"] [BaseDriver] Set implicit wait to 10000ms [MJSONWP] Responding to client with driver.timeouts() result: null [HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts 200 5 ms - 76 [HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url {"url":"https://us.justdial.com"} [MJSONWP] Calling AppiumDriver.setUrl() with args: ["https://us.justdial.com","b284c843-d3e4-4d13-94aa-a9f752377fe8"] [ADB] Getting connected devices... [ADB] 1 device(s) connected [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"] [ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"] [ADB] Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13) at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9) at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21) at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13) at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9) at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21) at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) [MJSONWP] Encountered internal error running command: Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13) at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9) at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21) at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) [HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url 500 40572 ms - 553 Frequent Error: An unknown server-side error occurred while processing the command. Original error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Please look into same.
Since you are trying to test web app in browser, why not to do it this way: DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER); // if chrome is installed, but not default one - use MobileBrowserType.CHROME AppiumDriver<MobileElement> driver = new AndroidDriver<>( new URL("http://127.0.0.1:4723/wd/hub"), capabilities ); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://us.justdial.com"); It works perfectly for me with Appium java client 5.0.4 / server 1.7.1
Removed "Unlock" and "Appium settings" apps from device - Appium installs those apps automatically. Also, passed appium arguments in my scripts. Below are the changes: import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import io.appium.java_client.AppiumDriver; public class Appium_device { //String driverPath = "F:/ChromeDriver/chromedriver.exe"; AppiumDriver<?> driver; #BeforeTest public void Appium_device() throws MalformedURLException, Exception { { // APPLICATION_LOG.info("Initializing project properties"); DesiredCapabilities capabilities = new DesiredCapabilities(); // Set android deviceName desired capability. Set your device name. // capabilities.setCapability("deviceName", "5203a1bbea4a8385"); // capabilities.setCapability("deviceName", "4100df0accbd9f00"); // capabilities.setCapability("deviceName", "0123456789ABCDEF"); capabilities.setCapability("deviceName", "4d007af54ac04177"); // Set BROWSER_NAME desired capability. It's Android in our case here. capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android"); // capabilities.setCapability("browsername", "chrome"); // capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe"); // Set android VERSION desired capability. Set your mobile device's OS version. // capabilities.setCapability(CapabilityType.VERSION, "4.2.2"); // capabilities.setCapability(CapabilityType.VERSION, "6.0.1"); capabilities.setCapability(CapabilityType.VERSION, "6.0.1"); // Set android platformName desired capability. It's Android in our case here. capabilities.setCapability("platformName", "Android"); // Set android appPackage desired capability. It is // com.android.calculator2 for calculator application. // Set your application's appPackage if you are using any other app. // capabilities.setCapability("appPackage", "org.mozilla.firefox"); capabilities.setCapability("appPackage", "com.android.chrome"); // Set android appActivity desired capability. It is // com.android.calculator2.Calculator for calculator application. // Set your application's appPackage if you are using any other app. capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main"); // capability.setCapability("binary", "C:\Program Files\Google\Chrome\Application"); // Created object of RemoteWebDriver will all set capabilities. // Set appium server address and port number in URL string. // It will launch calculator app in android device. // webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe'); // RemoteWebDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); // webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); // capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); // capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER); driver = new AppiumDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"),capabilities); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } } #Test public void launch() throws Exception { try { //driver.get("https://us.justdial.com"); driver.navigate().to("https://us.justdial.com"); System.out.println("site hit"); } catch (Exception e) { System.out.println("site not accessed"); throw (e); // TODO: handle exception } }} Thanks a ton to all for your helpful suggestions.
Appium session, could not find a connected Android device. Shows error
Appium session, could not find a connected Android device. Shows error in eclipse If any one know how to fix please let me know. **The Junit code: - ** import static org.junit.Assert.*; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.remote.MobileCapabilityType; import io.appium.java_client.remote.MobilePlatform; public class desiredCapab { #Test public void test() throws MalformedURLException { File appDir = new File("C:\\Eclipse-Neon\\Project\\AppiumT\\Apk\\"); File app = new File (appDir, "WhatsApp.apk"); DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID); cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); AndroidDriver driver = new AndroidDriver(new URL ("http://127.0.0.1:4723/wd/hub"), cap); //{"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"} } } Eclipse Junit Error :- org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 28.61 seconds Build info: version: '2.49.0', revision: '365eeb4', time: '2016-01-13 18:33:29' System info: host: 'DESKTOP-PC1SJR4', ip: '192.168.1.104', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91' AVD manager setting: - Image Appium :- Error message > info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"C:\\Eclipse-Neon\\Project\\AppiumT\\Apk\\WhatsApp.apk","platformName":"Android","deviceName":"Android Emulator"}} > info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_91) > info: [debug] No appActivity desired capability or server param. Parsing from apk. > info: [debug] No appPackage desired capability or server param. Parsing from apk. > info: [debug] Using local app from desired caps: C:\Eclipse-Neon\Project\AppiumT\Apk\WhatsApp.apk > info: [debug] Creating new appium session c9232f90-f519-4058-9e80-22cd2830de57 > info: Starting android appium > info: [debug] Getting Java version > info: Java version is: 1.8.0_101 > info: [debug] Checking whether adb is present > info: [debug] Using adb from C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe > info: [debug] Parsing package and activity from app manifest > info: [debug] Checking whether aapt is present > info: [debug] Using aapt from C:\Users\bizBoxChat\AppData\Local\Android\sdk\build-tools\24.0.3\aapt.exe > info: [debug] Extracting package and launch activity from manifest. > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\build-tools\24.0.3\aapt.exe dump badging C:\Eclipse-Neon\Project\AppiumT\Apk\WhatsApp.apk > info: [debug] badging package: com.whatsapp > info: [debug] badging act: com.whatsapp.Main > info: [debug] Parsed package and activity are: com.whatsapp/com.whatsapp.Main > 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: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > info: [debug] Could not find devices, restarting adb server... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server > info: [debug] Getting connected devices... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > info: [debug] Could not find devices, restarting adb server... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server > info: [debug] Getting connected devices... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > info: [debug] Could not find devices, restarting adb server... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server > info: [debug] Getting connected devices... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > info: [debug] Could not find devices, restarting adb server... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe kill-server > info: [debug] Getting connected devices... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > 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: Could not find a connected Android device. > info: [debug] Error: Could not find a connected Android device. > at [object Object].ADB.getDevicesWithRetry (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:606:15) > at [object Object].androidCommon.prepareActiveDevice (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:400:12) > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:326:26) > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17 > at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13) > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34 > at [object Object].androidCommon.ensureDeviceLocale (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:371:45) > at [object Object].androidCommon.prepareEmulator (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:364:10) > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:325:26) > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17 > at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13) > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21 > at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34 > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:344:9) > at FSReqWrap.oncomplete (fs.js:95:15) > info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null} > info: <-- POST /wd/hub/session 500 28492.200 ms - 206
Reason of above error is, any device or AVD could not be found to be connected. Following lines in your error message show this: > info: [debug] Trying to find a connected android device > info: [debug] Getting connected devices... > info: [debug] executing cmd: C:\Users\bizBoxChat\AppData\Local\Android\sdk\platform-tools\adb.exe devices > info: [debug] 0 device(s) connected > info: [debug] Could not find devices, restarting adb server... > info: [debug] Error: Could not find a connected Android device. Just creating AVD in AVD manager is not sufficient. It has to be up and running (started and ready). To do that, select any AVD in your AVD manager, and click on "Start" button. Let the AVD boot. Wait. (It is similar to a real device switching on.) Or, some real device needs to be connected. In that device, "Developer Options" should be On. "USB debugging" should be On. Go to command prompt and run following command: adb devices Expected output: Some device or AVD should be shown as connected. Once you see any device or AVD connected, and retry, then your problem will be solved. Note: On running "adb devices" command in command window, if you see message like "abd.exe is an unrecognized internal or external command or batch file...", then you need to have adb.exe in path. You can add its path in environment variables, or simply run following command before running "adb devices": set path=%PATH%;"D:\AndroidSDK\platform-tools" Note that adb.exe file is in platform-tools folder on my PC, in Android SDK folder. You will need to modify this path as it is on your PC.
Try to use real device, since emulators are very slow and booting time will also take more time. Even real device also I was facing this kind of issue, Expecting causes : Android emulator startup issue ADB issue System config If adb issue, you need run following command in your cmd: adb kill-server adb start-server Then you try with Android emulator and make ensure you system has enough memory these emulator like VM this will CPU & memory of your system accountable amount.