Appium Grid on Android Real devices(zipalign apk failed)

I am executing Appium Grid on Real devices am facing this below issue intermittently

2016-04-28 09:17:13:056 - error: Failed to start an Appium session, err was: Error: zipAlignApk failed. Error: Command failed: C:\Windows\system32\cmd.exe /s /c ““D:\Appium Stuff\android-sdk-windows\build-tools\22.0.1\zipalign.exe” -f 4 D:\Selenium_Workspace\Android_CS_Grid\apk2.8.6.apk C:\Users\MALLIK~1\AppData\Local\Temp\116328-4144-1pu1a96\appium.tmp”
W/zip ( 9048): copy of ‘res/drawable-xhdpi-v4/viewmygoals_build_inactive.png’ failed

2016-04-28 09:17:13:111 - info: [debug] Error: zipAlignApk failed. Error: Command failed: C:\Windows\system32\cmd.exe /s /c ““D:\Appium Stuff\android-sdk-windows\build-tools\22.0.1\zipalign.exe” -f 4 D:\Selenium_Workspace\Android_CS_Grid\apk2.8.6.apk C:\Users\MALLIK~1\AppData\Local\Temp\116328-4144-1pu1a96\appium.tmp”
W/zip ( 9048): copy of ‘res/drawable-xhdpi-v4/viewmygoals_build_inactive.png’ failed

at C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:468:19
at ChildProcess.exithandler (child_process.js:758:5)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

2016-04-28 09:17:13:115 - info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: zipAlignApk failed. Error: Command failed: C:\Windows\system32\cmd.exe /s /c ““D:\Appium Stuff\android-sdk-windows\build-tools\22.0.1\zipalign.exe” -f 4 D:\Selenium_Workspace\Android_CS_Grid\apk2.8.6.apk C:\Users\MALLIK~1\AppData\Local\Temp\116328-4144-1pu1a96\appium.tmp”\nW/zip ( 9048): copy of ‘res/drawable-xhdpi-v4/viewmygoals_build_inactive.png’ failed\r\n)”,“origValue”:“zipAlignApk failed. Error: Command failed: C:\Windows\system32\cmd.exe /s /c ““D:\Appium Stuff\android-sdk-windows\build-tools\22.0.1\zipalign.exe” -f 4 D:\Selenium_Workspace\Android_CS_Grid\apk2.8.6.apk C:\Users\MALLIK~1\AppData\Local\Temp\116328-4144-1pu1a96\appium.tmp”\nW/zip ( 9048): copy of ‘res/drawable-xhdpi-v4/viewmygoals_build_inactive.png’ failed\r\n”},“sessionId”:null}

Try running the zipalign command a few times and see if it fails there.

Alternatively, you might want to try upgrading your Android build tools. The current version is version 23.0.3.

1 Like

I had this issue when apk was corrupted. (Not loaded fully)

Hi Degard,

How did you fixed that issue ?

@jonahss Can you help me with above issue ?