DeviceFarmer / stf

Control and manage Android devices from your browser.
https://devicefarmer.github.io
Other
3.45k stars 487 forks source link

devices stuck in preparing status #669

Open jeeook opened 1 year ago

jeeook commented 1 year ago

What is the issue or idea you have? devices stuck in preparing status

Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row. yes for android 14 devices

Please provide the steps to reproduce the issue. connect device to provider

What is the expected behavior? device should be ready

Do you see errors or warnings in the stf local output? If so, please paste them or the full log here. 2023-06-07T05:45:50.703Z INF/device:support:sdk 22738 [0000090f4cbd2793] Supports SDK 34 2023-06-07T05:45:50.704Z INF/device:support:abi 22738 [0000090f4cbd2793] Supports ABIs arm64-v8a 2023-06-07T05:45:50.773Z INF/device:resources:minicap 22738 [0000090f4cbd2793] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk" 2023-06-07T05:45:50.972Z INF/device:resources:service 22738 [0000090f4cbd2793] Checking whether we need to install STFService 2023-06-07T05:45:51.041Z INF/device:resources:service 22738 [0000090f4cbd2793] Running version check 2023-06-07T05:45:52.115Z INF/device:resources:service 22738 [0000090f4cbd2793] STFService up to date 2023-06-07T05:45:52.117Z INF/device:plugins:service 22738 [0000090f4cbd2793] Launching agent 2023-06-07T05:45:52.417Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "Starting minitouch agent" 2023-06-07T05:45:52.422Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "java.lang.NoSuchMethodException: android.view.IWindowManager$Stub$Proxy.injectKeyEvent [class android.view.KeyEvent, boolean]" 2023-06-07T05:45:52.423Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at java.lang.Class.getMethod(Class.java:2937)" 2023-06-07T05:45:52.424Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at java.lang.Class.getMethod(Class.java:2449)" 2023-06-07T05:45:52.425Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at jp.co.cyberagent.stf.compat.InputManagerWrapper$WindowManagerEventInjector.(InputManagerWrapper.java:93)" 2023-06-07T05:45:52.426Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at jp.co.cyberagent.stf.compat.InputManagerWrapper.(InputManagerWrapper.java:19)" 2023-06-07T05:45:52.427Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at jp.co.cyberagent.stf.MinitouchAgent.(MinitouchAgent.java:288)" 2023-06-07T05:45:52.428Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at jp.co.cyberagent.stf.Agent.main(Agent.java:65)" 2023-06-07T05:45:52.428Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)" 2023-06-07T05:45:52.429Z INF/device:plugins:service 22738 [0000090f4cbd2793] Agent says: "at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359)" 2023-06-07T05:45:54.399Z FTL/device 22725 [0000098dcdca2793] Setup had an error TimeoutError: operation timed out at afterTimeout (/app/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/main/timers.js:11:15) at Timeout.timeoutTimeout [as _onTimeout] (/app/node_modules/@devicefarmer/adbkit/node_modules/bluebird/js/main/timers.js:53:9) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) 2023-06-07T05:45:54.401Z FTL/util:lifecycle 22725 [0000098dcdca2793] Shutting down due to fatal error 2023-06-07T05:45:54.414Z INF/provider 1 [] Cleaning up device worker "0000098dcdca2793" 2023-06-07T05:45:54.414Z ERR/provider 1 [] Device worker "0000098dcdca2793" died with code 1

Please run stf doctor and paste the output here.

pcrepieux commented 1 year ago

Thanks @jeeook I see in you log: 2023-06-07T05:45:50.703Z INF/device:support:sdk 22738 [0000090f4cbd2793] Supports SDK 34

Which exact version of Android are you using ? I can currently only access Beta2 which still reports:

[ro.build.version.release_or_codename]: [UpsideDownCake]
[ro.build.version.sdk]: [33]

Do you have a beta3 or something at hand ?

jeeook commented 1 year ago

Hi, @pcrepieux Thank you for your quick answer. I'm using device with Beta3 now. I saw that beta3 is released today on this post https://android-developers.googleblog.com/2023/06/android-14-beta-3-and-platform-stability.html

I have a question.. Normally, when can you support the new sdk version when it updates?

pcrepieux commented 1 year ago

OK, just got OTA update to beta 3 this morning. Indeed, I reproduced the issue. Looks like we cannot retrieve the InputManager as before but I may have found another way to proceed 🤞 I'll push the code soon. I'd like to test it a bit before.

jeeook commented 1 year ago

@pcrepieux Thank you :)

pcrepieux commented 1 year ago

It needs to be a bit more tested but that could fix this issue: https://github.com/DeviceFarmer/STFService.apk/pull/111

jeeook commented 1 year ago

@pcrepieux I think you need to add new permission and foregroundServiceType. Please refer here : https://developer.android.com/about/versions/14/changes/fgs-types-required

pcrepieux commented 1 year ago

Hi @jeeook No worries for the moment as we don't have to target sdk 34 in https://github.com/DeviceFarmer/STFService.apk. But indeed, we'll need to take care of this sooner or later.

jeeook commented 1 year ago

@pcrepieux OK, I see. Thank you :)

sn00wden commented 1 year ago

@pcrepieux Hello, do you have any news about supporting SDK34?

pcrepieux commented 1 year ago

Since https://github.com/DeviceFarmer/STFService.apk/pull/111 is merged, it is now a matter of providing the apk in STF release. Meanwhile, if that's possible for you, you can also compile the apk and use it on your devices.