Android: App behavior changes when installing apk via Appium

Server version: 1.2.3
Server Caps: --full-reset, --app path/to/app, --device-name "Galaxy S5", --platform-version 4.4, --platform-name Android
What I’m Doing: launching Appium Server. Clicking inspector button. Manually interacting with the application.
Github issue: https://github.com/appium/appium/issues/3782


I swear I’m not user-erroring. I’ve done this like 20 times.

  • I have an edit form. It has 2 fields, a button, and a save button.
  • I perform the below test case and it is successful
  • I install the apk from Appium, perform the test case manually and it is unsuccessful
  • I unplug the device and put it to sleep, wake it up and perform the test case manually and it is successful

Test Case:

  1. Enter text field
  2. Enter date
  3. click button

Expected: Save button is enabled

Now, I install the same exact apk via Appium.
I perform the same exact test case and see that the Save button is disabled. It will always be disabled.

Then I unplug the device, put it to sleep, wake it up, and perform the test case.
After I do the above everything magically works.

When I do adb install path/to/app and perform the test case, the app behaves correctly.

@bootstraponline you mentioned you have a fix for this?

The differences I’ve seen in apps under test are related to the reset strategy. You could try omitting full reset and see if that helps.

I tried that. No avail. Other ideas? Any fixes the android devs on our side can do?

I’ll try installing via adb and then automating with appium server set to --no-reset to try and get around this issue.

Try setting noSign to true.

@JessicaSachs Can you extract the adb install cmd line from the Appium log? It should be something like info: [debug] executing: "/path/to/adb install dirka-dirka".

Yeah. Let me try noSign: True first and I’ll get you the full logs.

@bootstraponline sigh there’s no server flag for it. only a capability. I don’t think this will fix my issue, since I can’t pass my own capabilities through when I’m using Appium.app’s inspector. Can I?

What I do is start the app via ARC (using caps specified in appium.txt) and then appium inspector can be used.

1 Like

Let’s find out what args Appium is passing adb, then we might be able to cook up a fix or workaround.

1 Like

OK. @bootstraponline @0x1mason

Ended up ignoring inspector problems for now. Just trying to get it to work in the base case.
Nothing is solving the issue. here are all the logs for all possible permutations I’ve tried to get it to work.

Again, installing via adb, opening the app, and performing the same test case lets the app to behave correctly. It is only when I start a wd session with Appium where things go kapoof.

Client side code and then adb command that works

My args & caps:

  • --app path/to/app
  • platformName Android
  • platformVersion 4.4
  • deviceName "Galaxy S5"

Here’s all the logs:

  1. Install via abd and then launch Appium with --no-reset and without noSign link
  2. Install via abd and then launch Appium with --no-reset and noSign link
  3. Install via Appium with --full-reset and noSign link
  4. Install via Appium with noSign link
  5. Install via Appium link

Awesome data, thanks!

Here’s how it appears Appium is installing your apk (the c7bff… hash is your file):

"/Users/jessicasachs/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb" -s 12e74bde shell "pm install -r /data/local/tmp/c7bffc64e6d592e3110fe4ca86f72a0f.apk"

Can you try manually install using the -r switch. Ie,

"/Users/jessicasachs/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb" install -r /Users/jessicasachs/kinsa/automation-ios/buildOutput/MainActivity-release-aligned.apk

Does that repro the Appium behavior?

1 Like

@0x1mason
No, it doesn’t reproduce the problematic behavior, the app behaves correctly. :frowning:

  1. I deleted the existing app
  2. I ran the command you gave me.

See input/output:

Jessicas-MacBook-Pro:hangman jessicasachs$ "/Users/jessicasachs/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb" install -r /Users/jessicasachs/kinsa/automation-ios/buildOutput/MainActivity-release-aligned.apk

3920 KB/s (17024184 bytes in 4.240s)
    pkg: /data/local/tmp/MainActivity-release-aligned.apk
Success

Blergh. My device isn’t rooted or anything.

Dang.

Next thing to try:

  1. Copy the apk to /data/local/tmp using adb.
  2. Run
"/Users/jessicasachs/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb" -s 12e74bde shell "pm install -r /data/local/tmp/MainActivity-release-aligned.apk"

If that doesn’t work, are you at liberty to share the apk with me?

We couldn’t find the root cause, but @0x1mason was able to reproduce.
The latest for this issue lives in Github: https://github.com/appium/appium/issues/3782

You can supply a json configuration file for the “Selenium Grid Configuration” in the General Settings of the Appium app. The node config file usually has both the capabilities and the server configuration, though I am not sure if the Appium app will use the capabilities from the node configuration over what you have set in the app itself.