Skip to content

Error testing addon with web-ext in Android. Unable to retrieve current user #3315

@orsonwelles1941

Description

@orsonwelles1941

Is this a feature request or a bug?

bug

What is the current behavior?

Command:
web-ext run --target=firefox-android --android-device=55555555 --firefox-apk=org.mozilla.fenix

Error:

WebExtError: Unable to retrieve current user on 55555555
    at ADBUtils.getCurrentUser (file:///usr/lib/node_modules/web-ext/lib/util/adb.js:72:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ADBUtils.discoverInstalledFirefoxAPKs (file:///usr/lib/node_modules/web-ext/lib/util/adb.js:77:20)
    at async FirefoxAndroidExtensionRunner.apkPackagesDiscoveryAndSelect (file:///usr/lib/node_modules/web-ext/lib/extension-runners/firefox-android.js:257:22)
    at async FirefoxAndroidExtensionRunner.run (file:///usr/lib/node_modules/web-ext/lib/extension-runners/firefox-android.js:76:5)
    at async Promise.all (index 0)
    at async MultiExtensionRunner.run (file:///usr/lib/node_modules/web-ext/lib/extension-runners/index.js:67:5)
    at async run (file:///usr/lib/node_modules/web-ext/lib/cmd/run.js:173:3)
    at async Program.execute (file:///usr/lib/node_modules/web-ext/lib/program.js:270:7)
    at async file:///usr/lib/node_modules/web-ext/bin/web-ext.js:13:1

What is the expected or desired behavior?

The function:

  async getCurrentUser(deviceId) {
    log.debug(`Retrieving  current user on ${deviceId}`);
    const currentUser = await this.runShellCommand(deviceId, ['am', 'get-current-user']);
    const userId = parseInt(currentUser.trim());
    if (isNaN(userId)) {
      throw new WebExtError(`Unable to retrieve current user on ${deviceId}`);
    }
    return userId;
  }

in /usr/lib/node_modules/web-ext/lib/util/adb.js is not working for Android 6.0.1.
I have tested:

  async getCurrentUser(deviceId) {
    return 0;
  }

and it works. Obviously not a good solution.

Solution:
Add support for Android 6.0.1. If support for Android 6.0.1 is not planned to be added, this should be indicated in the documentation.

Version information (for bug reports)

  • Firefox version:
    Firefox Nightly 134.0a1 for Android
  • Your OS and version:
    Tested in Archlinux and Fedora Workstation 41. Android 6.0.1
node --version && npm --version && web-ext --version

v20.18.0
10.9.0
8.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions