UiAutomator2 is deleting appium-uiautomator2-server-debug-androidTest.apk

Hi, I have the same problem in the following issue:

I’m using Webdriverio with Appium, but in the issue above mykola-mokhnach is saying the problem is with using node_modules/appium-adb/jars/sign.jar and he said that -as you can see in the error logs- android-sdk should be updated so apksigner.jar gets used instead of sign.jar.

My problem is:

  1. The commentators changed the subject in the issue so there is no solution.
  2. I have apksigner.jar in /usr/lib/android-sdk/build-tools/27.0.1 but it seems it’s not being used.
  3. I don’t know how to get the same appium logs in the issue so I can get better insights.

Following is the output I’m getting in the terminal:

2020-01-07T14:21:48.297Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-01-07T14:21:50.893Z INFO @wdio/local-runner: Start worker 0-0 with arg: configs/wdio-appium.conf.js,--spec,./tests/features/static-pages.feature,[email protected]
[0-0] 2020-01-07T14:21:51.585Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /tests/features/static-pages.feature
[0-0] 2020-01-07T14:21:52.897Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-01-07T14:21:52.900Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session
[0-0] 2020-01-07T14:21:52.900Z INFO webdriver: DATA {
  capabilities: {
    alwaysMatch: {
      browserName: 'chrome',
      platform: 'android',
      platformName: 'android',
      deviceName: 'Baha',
      platformVersion: '9'
    },
    firstMatch: [ {} ]
  },
  desiredCapabilities: {
    browserName: 'chrome',
    platform: 'android',
    platformName: 'android',
    deviceName: 'Baha',
    platformVersion: '9'
  }
}
[0-0] 2020-01-07T14:21:59.868Z WARN webdriver: Request failed due to An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate. Original error Command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-adb/jars/sign.jar /home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk --override' exited with code 1
[0-0] 2020-01-07T14:21:59.869Z INFO webdriver: Retrying 1/3
[0-0] 2020-01-07T14:21:59.869Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session
[0-0] 2020-01-07T14:21:59.870Z INFO webdriver: DATA {
  capabilities: {
    alwaysMatch: {
      browserName: 'chrome',
      platform: 'android',
      platformName: 'android',
      deviceName: 'Baha',
      platformVersion: '9'
    },
    firstMatch: [ {} ]
  },
  desiredCapabilities: {
    browserName: 'chrome',
    platform: 'android',
    platformName: 'android',
    deviceName: 'Baha',
    platformVersion: '9'
  }
}
[0-0] 2020-01-07T14:22:01.906Z WARN webdriver: Request failed due to An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate. Original error Command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-adb/jars/sign.jar /home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk --override' exited with code 1
[0-0] 2020-01-07T14:22:01.907Z INFO webdriver: Retrying 2/3
2020-01-07T14:22:01.907Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session
[0-0] 2020-01-07T14:22:01.907Z INFO webdriver: DATA {
  capabilities: {
    alwaysMatch: {
      browserName: 'chrome',
      platform: 'android',
      platformName: 'android',
      deviceName: 'Baha',
      platformVersion: '9'
    },
    firstMatch: [ {} ]
  },
  desiredCapabilities: {
    browserName: 'chrome',
    platform: 'android',
    platformName: 'android',
    deviceName: 'Baha',
    platformVersion: '9'
  }
}
[0-0] 2020-01-07T14:22:02.992Z WARN webdriver: Request failed due to An unknown server-side error occurred while processing the command. Original error: The file at '/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' does not exist or is not accessible
[0-0] 2020-01-07T14:22:02.993Z INFO webdriver: Retrying 3/3
2020-01-07T14:22:02.993Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session
[0-0] 2020-01-07T14:22:02.993Z INFO webdriver: DATA {
  capabilities: {
    alwaysMatch: {
      browserName: 'chrome',
      platform: 'android',
      platformName: 'android',
      deviceName: 'Baha',
      platformVersion: '9'
    },
    firstMatch: [ {} ]
  },
  desiredCapabilities: {
    browserName: 'chrome',
    platform: 'android',
    platformName: 'android',
    deviceName: 'Baha',
    platformVersion: '9'
  }
}
[0-0] 2020-01-07T14:22:04.032Z ERROR webdriver: Request failed due to unknown error: An unknown server-side error occurred while processing the command. Original error: The file at '/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' does not exist or is not accessible
    at getErrorFromResponseBody (/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/webdriver/build/utils.js:124:10)
    at Request._callback (/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/webdriver/build/request.js:111:64)
    at Request.self.callback (/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/request/request.js:185:22)
    at Request.emit (events.js:305:20)
    at Request.EventEmitter.emit (domain.js:483:12)
    at Request.<anonymous> (/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:305:20)
    at Request.EventEmitter.emit (domain.js:483:12)
    at IncomingMessage.<anonymous> (/home/baha/Work/coding/islamqa-pwa/e2e/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:411:28)
    at IncomingMessage.emit (events.js:317:22)
    at IncomingMessage.EventEmitter.emit (domain.js:483:12)
    at endReadableNT (_stream_readable.js:1215:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

please, any help is appreciated.