Files
Detox/docs/introduction/partials/_debugging-native-code-run-android.mdx
T

57 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
```plain text
18:26:07.024 detox[45214] i Waiting for you to manually launch your app in Android Studio.
Instrumentation class: com.wix.detox.test.test/com.example.DetoxTestAppJUnitRunner
Instrumentation arguments:
------------------------------------
Key | Value
------------------------------------
detoxServer | ws://localhost:8099
detoxSessionId | test
------------------------------------
Press any key to continue...
```
Now it is time to switch back to Android Studio. You’ll need to run your instrumentation runner with the said arguments,
this is why you should create a debug configuration of `Android Instrumented Tests` type similar to the one below:
![Android Debug Configuration - Android Instrumented Tests](../../img/android-studio-debug-configuration.png)
Make sure to put breakpoints at the points of interest before you start the app.
After the app is launched, go back to the Terminal where Detox is running and press any key.
As a result, you are expected to see a confirmation from Detox, e.g.:
```plain text
Found the app (com.wix.detox-example) with process ID = 16854. Proceeding...
```
Now the entire test will run as usual until it sends an action to the app, which gets trapped
in your breakpoint.
![Breakpoint is active](../../img/android-happy-debugging.png)
Happy debugging!
P.S. If you see this timeout error too often while debugging:
```plain text
Waited for the new RN-context for too long! (60 seconds)
If you think that’s not long enough, consider applying a custom Detox runtime-config in DetoxTest.runTests().
```
you can temporarily hack the timeout here:
```diff title="detox/android/detox/src/main/java/com/wix/detox/config/DetoxConfig.kt"
package com.wix.detox.config
class DetoxConfig {
@JvmField var idlePolicyConfig: DetoxIdlePolicyConfig = DetoxIdlePolicyConfig()
- @JvmField var rnContextLoadTimeoutSec = 60
+ @JvmField var rnContextLoadTimeoutSec = Int.MAX_VALUE
fun apply() {
idlePolicyConfig.apply()
```