Android app crashing abruptly in Emulator

#1

Context : Emulator is getting started properly. App installation is successful. However will running the appium tests the app is crashing abruptly.
The same test is running fine in local so we’re not suspecting our test code. We are thinking something is going wrong with the emulator.

Questions:

  1. How can we get detailed logs of emulator crash?
  2. Are we missing some emulator config which might be causing this?
  • List item

Details/Logs:

±-----------------------------------------------------------------------------+
| bitrise summary |
±–±--------------------------------------------------------------±---------+
| ✓ | Initialise ENV Variables | 2.47 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | activate-ssh-key@4.0.3 | 4.22 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | avd-manager@1 | 46.05 sec|
±–±--------------------------------------------------------------±---------+
| ✓ | git-clone@4 | 24.21 sec|
±–±--------------------------------------------------------------±---------+
| ✓ | set-env-var@0 | 4.85 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | install-bundler@1 | 1.2 min |
±–±--------------------------------------------------------------±---------+
| ✓ | nvm@1.2.1 | 37.84 sec|
±–±--------------------------------------------------------------±---------+
| ✓ | Install npm packages | 1.6 min |
±–±--------------------------------------------------------------±---------+
| ✓ | file-downloader@1.0.1 | 4.05 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | Create Android Build | 10.7 min |
±–±--------------------------------------------------------------±---------+
| ✓ | Make app ready for push | 2.67 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | wait-for-android-emulator@1 | 4.43 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | Git clone appium repo | 5.85 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | Run appium doctor | 23.50 sec|
±–±--------------------------------------------------------------±---------+
| ✓ | Install & run Appium | 17.79 sec|
±–±--------------------------------------------------------------±---------+
| ✓ | Add appium specific ENV | 2.27 sec |
±–±--------------------------------------------------------------±---------+
| x | Run Appium Tests (exit code: 1) | 12.2 min |
±–±--------------------------------------------------------------±---------+
| ✓ | Export artifacts | 2.44 sec |
±–±--------------------------------------------------------------±---------+
| ✓ | deploy-to-bitrise-io@1 | 11.07 sec|
±–±--------------------------------------------------------------±---------+
| Total runtime: 29.0 min |
±-----------------------------------------------------------------------------+

Emulator is getting started :

- Device with serial: emulator-5554 started
- Done

Config:
- AndroidHome: /opt/android-sdk-linux
- APILevel: 26
- Tag: google_apis
- DeviceProfile: Nexus 5
- CreateCommandArgs: --sdcard 1024M
- StartCommandArgs: -camera-back none -camera-front none
- ID: emulator
- Abi: x86
- EmulatorChannel: 0

However while running the appium tests it’s giving element not found exception

[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/69aaeb72-04aa-4b58-9aad-c5e1296103d6/element] with body: {"strategy":"accessibility id","selector":"inputTextBox-Full name","context":"","multiple":false}
[WD Proxy] Got response with status 404: {"sessionId":"69aaeb72-04aa-4b58-9aad-c5e1296103d6","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:70)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:41)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:261)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:255)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann...
[debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError
[debug] [W3C (066cb5fb)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
[debug] [W3C (066cb5fb)]     at AndroidUiautomator2Driver.findElOrEls (/root/.nvm/versions/node/v10.8.0/lib/node_modules/appium/node_modules/appium-android-driver/lib/commands/find.js:75:11)
[debug] [W3C (066cb5fb)]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session/066cb5fb-bfff-467a-9338-b26656a7757c/element 404 199 ms - 476

0 Likes

#2

Hello there @umair_reed :wave:

Sorry to hear about your issue. Since we do not directly support Appium, it is also a bit harder to debug it or to get more detailed information about what happens during the time it is running on the Virtual Machine.
Normally, if you were using a prebuilt step, such as the Android Build for UI testing, you would have more available options for debugging, but you can also export the build reports to Test Reports, so you might see more information about where the tests fail: https://devcenter.bitrise.io/testing/exporting-to-test-reports-from-custom-script-steps/

If you still have issues with the emulator crashing, could you please send us a build URL of the related build and enable Support Access on the Settings tab of the app (https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/), so that we may take a closer look? :slight_smile:

0 Likes