Appium tests dont run on the android emulator

Bitrise Build Issue Report template

Description of the issue

I have created an emulator and launched it with AVD manager step in bitrise. When i try to run the appium scripts, i get an error [UIAutomator2] unable to force stop app.
then there is a time out error and the test doesnt run correctly.
the emulator gets booted after ~500 seconds. then after that the appium tests dont run on them. they fail in trying to set up the emulator with the app and the uiautomator2 agent.

Environment:

Hybrid Mac OS stable version ( the most advanced stack on bitrise)

Which build Step causes the issue and which version of the step?

The Script step that launches the appium test.

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Everytime
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : always

Local reproduction

it runs perfectly on my machine.

Local reproduction: Linux / Android (docker based) stack builds

havent tried it yet.

Build log

Hi @HRavichandran,

Can you please provide a link to the related build? We’ll have to check the full log & config to be able to help.

Doing this might also help. Related guides:

I tried with local cli in my mac. it worked fine.
this is the url to the build that failed.
https://www.bitrise.io/build/32cecba34a7e6991

Hi @HRavichandran!

Seems like you have a wrong configuration of the emulator:
emulator: ERROR: Missing initial data partition file: /Users/vagrant/.android/avd/Pixel.avd/userdata.img

Please clear the customized input fields of the AVD Manager step, and change only the API level. Try it like that, and please let us know if the tests are able to start this way. If yes, you can setup the resolution and the device profile from there.

I tried with your idea. still doesnt work.

Could you please pass the build’s url, or contact us on our on-site chat referring to this article?

this is the build url
https://www.bitrise.io/build/b78a99d8c801dc0d

Please clear the customized input fields of the AVD Manager step, and change only the API level.

I meant not to clear fully but to restore to the default value.

Please set this to custom HW config:

disk.dataPartition.size=1024M
hw.camera.back=emulated
hw.camera.front=emulated
hw.keyboard=yes
hw.gpu.enabled=true
hw.gpu.mode=swiftshader
hw.ramSize=1536
runtime.network.latency=none
runtime.network.speed=full
showDeviceFrame=no
skin.dynamic=yes
skin.path=_no_skin
skin.path.backup=_no_skin
vm.heapSize=384
1 Like