web-ext: Cannot load extensions on android build variants

This is a follow-up from this PR where we learnt that build variants aren’t supposed: https://github.com/mozilla/web-ext/pull/1871#issuecomment-605400070

Is this a feature request or a bug?

Bug

What is the current behavior?

  1. Install a local debug build of Reference Browser; affects Fenix too.
  2. Run the following command:
web-ext run -t firefox-android --android-device=<device ID here> --firefox-apk=org.mozilla.reference.browser.debug --firefox-apk-component=BrowserActivity
  1. Observe.

What is the expected or desired behavior?

You should be able to install your web extension.

What is the actual behaviour?

You see the following output in your terminal:

Error: Activity class {org.mozilla.reference.browser.debug/org.mozilla.reference.browser.debug.BrowserActivity} does not exist.
    at /Users/jalmeida/src/web-ext/node_modules/adbkit/lib/adb/command/host-transport/startactivity.js:57:21
    at tryCatcher (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/promise.js:503:31)
    at Promise._settlePromiseAt (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/promise.js:577:18)
    at Async._drainQueue (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/jalmeida/src/web-ext/node_modules/bluebird/js/main/async.js:15:14)

Version information (for bug reports)

  • Firefox version: Desktop: 77.0a1 (2020-04-21) (64-bit), Android: GV 77.0.20200422093542
  • Your OS and version: Mac OS 10.15.4 (19E287) / Android 10
  • Paste the output of these commands:
node --version && npm --version && web-ext --version

v13.11.0 6.13.7 4.1.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

I agree with that - just created a PR.

Side note - What are your thoughts on adding

<action android:name="android.intent.action.MAIN" />

between the <intent-filter> tags for .BrowserActivity in the Reference Browser repo?

https://github.com/mozilla-mobile/reference-browser/blob/1a99279d874cc1a53d8740711c45a12531d1c879/app/src/main/AndroidManifest.xml#L39-L48

I use that line to instantly launch my local debug of the Reference Browser for the .BrowserActivity component:

--firefox-apk-component=org.mozilla.reference.browser.BrowserActivity

You can only have one activity with the main action since it’s the entry point for an app from the launcher. We keep it on the .App alias (which points to the BrowserActivity) for legacy reasons to avoid breaking older builds.

@MikeM711 What would be the advantage of your proposal, over the following logic:

  1. If apkComponent has a ., use ${apk}/${apkComponent}
  2. Else if apkComponent is given, use current logic: ${apk}/.${apkComponent}
  3. Else use current fallback: ${apk}/.App

This would solve the issue here, without requiring a hard-coded list of values. Usage example:

web-ext run -t firefox-android --android-device=<device ID here> --firefox-apk=org.mozilla.reference.browser.debug --firefox-apk-component=org.mozilla.reference.browser.BrowserActivity

And with web-ext run -t firefox-android --android-device=<device ID here> --firefox-apk=org.mozilla.fenix.performancetest --firefox-apk-component=org.mozilla.fenix.HomeActivity

@Rob--W Oh wow - you’re right, it’s good now

Currently going ahead and building a local debug build of the Reference Browser. Looks like I need the android-components and application-services repos along with the reference-browser, if I’m not mistaken? Will be fiddling around with it.

You shouldn’t need to build custom app services and android components for this. The pre-built dependencies should just work. If they do not, please file an issue and we’ll fix it asap. 🙂

@MikeM711 Have you enabled “Remote debugging via USB” in the Settings view of the Reference Browser?