Skip to content

Commit ad3a930

Browse files
docs: how to run unit tests in Android Studio
Related: #493
1 parent 22518c9 commit ad3a930

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/site/markdown/android.md

+24
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,27 @@ Starting with Android 9 (API level 28) you need to explicitly allow cleartext tr
5757
```
5858

5959
Reference: https://developer.android.com/training/articles/security-config
60+
61+
## How to run unit tests in Android Studio?
62+
63+
Local unit tests are tests that run on your machine's local Java Virtual Machine.
64+
65+
Reference: https://developer.android.com/studio/test/test-in-android-studio
66+
67+
Since they run on your machine, the JSON library must be manually included for the tests (because it is not provided by the Android runtime):
68+
69+
`build.gradle`
70+
71+
```
72+
dependencies {
73+
implementation ('io.socket:socket.io-client:2.0.1') {
74+
exclude group: 'org.json', module: 'json'
75+
}
76+
77+
testImplementation 'org.json:json:20090211'
78+
79+
...
80+
}
81+
```
82+
83+
Note: we use this ancient version of `org.json` because it is compatible with the one bundled in Android.

0 commit comments

Comments
 (0)