Installed the new version 1.11.1 and attempted to run my automation scripts (that worked with 1.10.1).
After starting appium and then kicking off my automation, I encounter an error:
[W3C] Encountered internal error running command: Error: zipAlignApk failed. Original error: Command 'C\:\Users\dkusc\AppData\Local\Android\sdk\build-tools\28.0.3\zipalign.exe -f 4 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' C\:\Users\dkusc\AppData\Local\Temp\201925-35412-1qadtch.jjmr\appium.tmp' exited with code 1. Stdout: ''; Stderr: 'Unable to open 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' as zip archive
The appium-uiautomator2-server-debug-androidTest.apk does not exist in that directory.
v1.11.1 desktop connected to a real device.
V1.10.1 was working ok.
c#
Moved to Appium Desktop
AppiumOptions capabilities = new AppiumOptions();
capabilities.AddAdditionalCapability("platformName", "Android");
capabilities.AddAdditionalCapability("platformVersion", "6.0.1"); //Susans
capabilities.AddAdditionalCapability("deviceName", "gtaxlwifi"); //susans
capabilities.AddAdditionalCapability("newCommandTimeout",120000);
capabilities.AddAdditionalCapability("adbExecTimeout", 500000);
capabilities.AddAdditionalCapability("noReset", true);
capabilities.AddAdditionalCapability("dontStopAppOnReset", true);
// capabilities.AddAdditionalCapability("automationName", "UIAutomator2");
It appears to be an issue with the above capabilities - capabilities.AddAdditionalCapability("automationName", "UIAutomator2");
When I uncomment this out, then the application is unable to sign the debug version and deletes it.
GIST Log for version 1.10.1 which will now not work either upon reinstall.
https://gist.github.com/susanma/0d7be377b4af384019c630b6bb374481
I donwloaded appium-desktop-setup-1.11.0.exe in https://github.com/appium/appium-desktop/releases/download/v1.11.0/appium-desktop-setup-1.11.0.exe and extract the package on mac.
Then, I could find the file below
â¨app-64⊠⸠â¨resources⊠⸠â¨app⊠⸠â¨node_modules⊠⸠â¨appium⊠⸠â¨node_modules⊠⸠â¨appium-uiautomator2-server⊠⸠â¨apks⊠⸠appium-uiautomator2-server-debug-androidTest.apk
Could you re-install the pachage again?
Maybe, the apk file was missed.
I'm currently having the same issue. The UiAutomator2 apk is available for use and I've given Appium permission to view it even though I always run Appium as an admin.
Running zipalign -f 4 path\to\app.apk aligned.apk gives the same error, "Unable to open 'path\to\app.apk' as zip archive".
This exact apk was working recently. I've not changed anything other than updated my device's OS and downloaded the new Android SDK (9.0). I don't know if it's relevant but the app was made using Xamarin.
OS: Windows 10
Device: Samsung Galaxy S8, Android 9
Appium: v1.11.1
Android SDK Build Tools: v28.0.3
Android SDK Platform Tools: v28.0.2
When I built apks with 29.0 rc build tools, the same issue happened even the zipalign was bundled in the 29 rc toolchain.
I think if you build the apk with 28.0.3 toolchain, it does not happen.
https://github.com/appium/appium/issues/12311#issuecomment-473535496
I eventually gave up and went back to version 1.9
Same thing happens in version 12.0
A bug that Xamarin apps cannot work with Appium has been confirmed.
I am creating an issue in Xamarin.
https://github.com/xamarin/xamarin-android/issues/4069
but,
I eventually gave up and went back to version 1.9
I checked with version 1.9.1, and the Xamarin app was able to work with Appium.
https://github.com/appium/appium-desktop/releases/tag/v1.9.1
I checked with version 1.9.1, and the Xamarin app was able to work with Appium.
Is this automationName = uiautomator2?
uiautomator2 depends on Android Accessibility info.
@KazuCocoa
Yes, The details are as follows, and the settings have not been changed.
{
"platformName": "Android",
"deviceName": "Android Emulator",
"automationName": "UiAutomator2",
"avd": "Pixel_3a_API_28",
"appPackage": "net.gremito.app.xamarin.appname",
"appActivity": "md53ed500d57a300a1b65c55bb91ad526f0.MainActivity",
"app": "/Users/gremito/xamarin/appname/Droid/bin/Debug/net.gremito.app.xamarin.appname.apk"
}
Thank.
How about Espresso Driver?
I have never worked with the espresso tool, but when using the espresso tool I realize that I need to incorporate espresso into my app.
We avoid espresso because we want to test the app in a state close to production.
Appium's espresso driver just re-package with appium-dev's sign like uia2 driver does.
If your espresso means Google's vanilla espresso, it is a bit different. (Internally, espresso driver handles the app under test via Espresso APIs.)
https://appium.io/docs/en/drivers/android-espresso/
Espresso driver gets elements more directly by Android APIs like View. So, I wondered if it worked for you.
I'm struggling with the same phenomena as the linked issue.
Details are as follows.
It has been confirmed that the situation does not change even if noSign is set or removed.
https://github.com/appium/appium-espresso-driver/issues/302
I found a way around the error.
Uninstall Appium related apps and apps you want to test.

Build the app in Release mode, not Debug mode, in the project that builds the app (such as Android Studio or Xamarin).

Start a session with either UiAutomator2 or Espresso from the Appium desktop app.
With this support, it was confirmed that version 1.9.1 and the latest can be linked normally.
Around here is the cause of sign. Probably your environment failed to sign with apksigner.
[ADB] Checking app cert for /var/folders/hm/0rhbvj1d7t769n29dm9t3dzw0000gn/T/io.appium.espressoserver.test_1.16.0_com.xxx.yyy.xamarin_app.apk
[ADB] Using 'apksigner' from '/Users/gremito/Library/Android/sdk/build-tools/29.0.2/apksigner'
[ADB] Starting '/Users/gremito/Library/Android/sdk/build-tools/29.0.2/apksigner' with args '["verify","--print-certs","/var/folders/hm/0rhbvj1d7t769n29dm9t3dzw0000gn/T/io.appium.espressoserver.test_1.16.0_com.xxx.yyy.xamarin_app.apk"]'
[ADB] Got an error during apksigner execution: Command '/Users/gremito/Library/Android/sdk/build-tools/29.0.2/apksigner verify --print-certs /var/folders/hm/0rhbvj1d7t769n29dm9t3dzw0000gn/T/io.appium.espressoserver.test_1.16.0_com.xxx.yyy.xamarin_app.apk' exited with code 1
[ADB] apksigner stderr: DOES NOT VERIFY
[ADB] ERROR: JAR signer CERT.RSA: JAR signature META-INF/CERT.SF indicates the APK is signed using APK Signature Scheme v2 but no such signature was found. Signature stripped?
[ADB]
Yes, but changing from Debug build to Release build did not solve the above problem, so it was important to uninstall everything.
Most helpful comment
A bug that Xamarin apps cannot work with Appium has been confirmed.
I am creating an issue in Xamarin.
https://github.com/xamarin/xamarin-android/issues/4069
but,
I checked with version 1.9.1, and the Xamarin app was able to work with Appium.
https://github.com/appium/appium-desktop/releases/tag/v1.9.1