Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why am I required to do manually when before I didn't need to? #501

Open
AlbertoMeQ opened this issue Feb 14, 2023 · 3 comments
Open

Why am I required to do manually when before I didn't need to? #501

AlbertoMeQ opened this issue Feb 14, 2023 · 3 comments

Comments

@AlbertoMeQ
Copy link

Hello!

2 months or so ago I had managed to setup appium + UIAutomator2. I just needed to install the driver (via NPM) and everything magically worked.

Today, I spent a few hours trying to understand why I kept getting the following error:

[debug] [Instrumentation] INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
[debug] [Instrumentation] INSTRUMENTATION_STATUS: id=ActivityManagerService
[debug] [Instrumentation] INSTRUMENTATION_STATUS_CODE: -1
[debug] [Instrumentation] android.util.AndroidException: INSTRUMENTATION_FAILED: io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
[debug] [Instrumentation] 	at com.android.commands.am.Instrument.run(Instrument.java:524)
[debug] [Instrumentation] 	at com.android.commands.am.Am.runInstrument(Am.java:199)
[debug] [Instrumentation] 	at com.android.commands.am.Am.onRun(Am.java:80)
[debug] [Instrumentation] 	at com.android.internal.os.BaseCommand.run(BaseCommand.java:62)
[debug] [Instrumentation] 	at com.android.commands.am.Am.main(Am.java:50)
[debug] [Instrumentation] 	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[debug] [Instrumentation] 	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
[debug] [Instrumentation] The process has exited with code 1

I managed to fix it by downloading this repository and following its steps (gradle clean assemble + manually install the 2 apks).

My question is: why is this now required for the automation to work when before all was nice and easy?

Also, I was planning to use appium and Browserstack but if I wouldn't be able to install the 2 apks manually every time. So, I must find a better solution.

Is this a bug somewhere else or is the new "workflow"?

@jlipps
Copy link
Member

jlipps commented Feb 14, 2023

My question is: why is this now required for the automation to work when before all was nice and easy?

It is not required, no.

It's not clear that there is a bug. Make sure you have the latest version of Appium 2 and then try this with your device connected to clear everything out and upgrade the driver to the latest version:

appium driver run uiautomator2 reset
appium driver update uiautomator2

@AlbertoMeQ
Copy link
Author

Hello @jlipps,

Thanks for the reply.

Here is the output of those commands:

$ appium driver run uiautomator2 reset
[STDERR] node:internal/modules/cjs/loader:1056
[STDERR] throw err;
[STDERR] ^
[STDERR]
[STDERR] Error: Cannot find module '<MY_USER>/appium/node_modules/appium-uiautomator2-driver/scripts/reset.js'
[STDERR] at Module._resolveFilename (node:internal/modules/cjs/loader:1053:15)
[STDERR] at Module._load (node:internal/modules/cjs/loader:898:27)
[STDERR] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:84:12)
[STDERR] at node:internal/main/run_main_module:23:47 {
[STDERR] code: 'MODULE_NOT_FOUND',
[STDERR] requireStack: []
[STDERR] }
[STDERR]
[STDERR] Node.js v19.4.0
✖ Encountered an error when running 'reset': Process ended with exitcode 1 (cmd: '/usr/local/bin/node scripts/reset.js')

=======

$ appium driver update uiautomator2
✔ Checking if driver 'uiautomator2' is updatable
✖ Checking if driver 'uiautomator2' needs an update
ℹ Update report:
ℹ - 'uiautomator2' had no updates available

@jlipps
Copy link
Member

jlipps commented Feb 21, 2023

ok, try the latest uiautomator2 driver. it was not correctly exporting the reset script before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants