mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.65k stars 334 forks source link

web-ext has no way to specify a user to use on Android, causing it to fail. #3116

Closed Flyingbacen closed 2 months ago

Flyingbacen commented 3 months ago

Is this a feature request or a bug?

bug

What is the current behavior?

I'm attempting to install a plugin to my android device to test it, but I'm getting the error No Firefox packages were found on the selected Android device. Running verbose, I found it running pm list packages, so I ran it myself, and got the next error Shell does not have permission to access user 10 with no extra arguments. I have to manually specify in the command to use user 0 to find firefox, but I am unable to do that as far as I'm aware

What is the expected or desired behavior?

have a fallback or ask the user to enter the user id

Version information (for bug reports)

android nightly - 127.0a1 OS - Ubuntu 20.04 Phone: Samsung A13 node: 20.12.2 npm: 10.5.0 web-ext: 7.11.0

Rob--W commented 2 months ago

Could you share your verbose log?

We added auto-detection of --user in https://github.com/mozilla/web-ext/pull/2857. We need more information before we can improve this.

kizaski commented 2 months ago

I'm experiencing the same issue. Here are my verbose logs


[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\program.js][info] Version: 7.11.0
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\program.js][debug] Discovering config files. Set --no-config-discovery to disable
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\config.js][debug] Discovered config "C:\Users\kiril\.web-ext-config.js" does not exist or is not readable
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\config.js][debug] Discovered config "C:\dev\github\borderify\package.json" does not exist or is not 
readable
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\config.js][debug] Discovered config "C:\dev\github\borderify\web-ext-config.js" does not exist or is not readable
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\cmd\run.js][info] Running web extension from C:\dev\github\borderify
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\util\manifest.js][debug] Validating manifest at C:\dev\github\borderify\manifest.json
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\extension-runners\firefox-android.js][debug] Listing android devices
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\util\adb.js][debug] Listing android devices
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\extension-runners\firefox-android.js][info] Selected ADB device: 192.168.1.6:5555
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\util\adb.js][debug] Listing installed Firefox APKs on 192.168.1.6:5555
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\util\adb.js][debug] Run adb shell command on 192.168.1.6:5555: ["pm","list","packages"]
[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\program.js][error] 
UsageError: No Firefox packages were found on the selected Android device
    at FirefoxAndroidExtensionRunner.apkPackagesDiscoveryAndSelect (file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/lib/extension-runners/firefox-android.js:247:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FirefoxAndroidExtensionRunner.run (file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/lib/extension-runners/firefox-android.js:64:5)   
    at async Promise.all (index 0)
    at async MultiExtensionRunner.run (file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/lib/extension-runners/index.js:66:5)
    at async run (file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/lib/cmd/run.js:177:3)
    at async Program.execute (file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/lib/program.js:268:7)
    at async file:///C:/ProgramData/nvm/v20.11.1/node_modules/web-ext/bin/web-ext.js:13:1

[C:\ProgramData\nvm\v20.11.1\node_modules\web-ext\lib\program.js][debug] Command executed: run
kizaski commented 2 months ago

The problem is the code from the PR @Rob--W mentioned is somehow not in the 7.11.0 release from Jan 24

willdurand commented 2 months ago

I submitted a PR to backport the fix: https://github.com/mozilla/web-ext/pull/3146

willdurand commented 2 months ago

Please try https://github.com/mozilla/web-ext/releases/tag/7.12.0

kizaski commented 2 months ago

Now web-ext run works. Thanks!

willdurand commented 2 months ago

I am going to close this issue now.