You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is meant to run on iOS and Android, so you need to follow the "Platform setup" section of that guide to
13
13
install the iOS and/or Android platform.
14
+
14
15
> [!WARNING]
15
-
> Installing on Linux using `snapd` might cause some [problems](../../issues/123) building stockfish.
16
+
> Installing on Linux using `snapd` might cause some [problems](https://github.com/lichess-org/mobile/issues/123) building stockfish.
16
17
> Installing flutter manually is a known workaround.
18
+
17
19
2. Switch to the beta channel by running `flutter channel beta` and `flutter upgrade`
20
+
18
21
> [!NOTE]
19
22
> We'll use Flutter's `beta` channel while the app itself is in Beta.
23
+
20
24
3. Ensure Flutter is correctly configured by running `flutter doctor`
21
25
22
26
Note that this application is not meant to be run on web platform.
@@ -47,68 +51,76 @@ The fastest and most straight-forward way to get started is using [lila-docker](
47
51
48
52
Instructions to install both `lila` and `lila-ws` locally can be found in [the lila wiki](https://github.com/lichess-org/lila/wiki/Lichess-Development-Onboarding).
49
53
50
-
**Do not use any scheme (https:// or ws://) in url in host, since it's already handled by URI helper methods**
54
+
## Setting up a device
51
55
52
-
To run the application with a local server, you can use the following command:
56
+
### Real device
53
57
54
-
```bash
55
-
flutter run --dart-define=LICHESS_HOST=localhost:9663 --dart-define=LICHESS_WS_HOST=localhost:9664
56
-
```
58
+
#### Android
57
59
58
-
> [!NOTE]
59
-
> The hosts above are the default ports for lila, if you have changed them, you
60
-
will need to adjust the command accordingly.
60
+
To use a real device you will need to [enable developer options](https://developer.android.com/studio/debug/dev-options) on it and have [adb](https://developer.android.com/tools/adb) installed on your computer.
61
61
62
-
## Setting up the emulators
62
+
Once that done, you can [connect your device](https://developer.android.com/studio/run/device) either with USB or with Wi-Fi.
63
63
64
-
###iOS
64
+
##### Connect with USB
65
65
66
-
Simply follow the instructions in the flutter guide to install Xcode and the iOS
67
-
simulator.
66
+
Enable USB debugging and connect your phone with USB.
68
67
68
+
Run `adb devices` to check that your device is connected.
69
69
70
-
###Android
70
+
##### Connect with Wi-Fi
71
71
72
-
#### When using a manually installed lila server
72
+
On your Android phone:
73
73
74
-
If you are working with a local `lila` server, you need to expose some ports from the emulator. You can do this by
75
-
running the following command (once the emulator is running):
74
+
1. Connect your phone to the same wifi network as your host machine
75
+
2. In Developer Options, toggle Wireless Debugging to ON
76
+
3. Tap "Wireless Debugging" to enter its menu
77
+
4. Select **Pair device with pairing code**
76
78
77
-
```bash
78
-
adb reverse tcp:9663 tcp:9663
79
-
adb reverse tcp:9664 tcp:9664
80
-
```
79
+
On your computer:
81
80
82
-
This will allow the app to communicate with the local server. 9663 is for `http`
83
-
and 9664 is for `websocket`. It assumes that the server is running on the
84
-
default ports.
81
+
1. Pair your phone with `adb pair [phone_ip_address]:[pair_port] [pairing_code]`.
82
+
2. Connect your phone with `adb connect [phone_ip_address]:[connection_port]`.
83
+
Your phone IP address and connection port should be written on the wireless debugging menu.
84
+
3. Check that your device is connected with `adb devices`
85
85
86
-
#### When using lila-docker
86
+
###Emulators
87
87
88
-
When using [lila-docker](https://github.com/lichess-org/lila-docker), first run `./lila-docker hostname` and select your
89
-
computer's IP address. Then, instead of the commands above, use this:
88
+
#### iOS
90
89
91
-
```bash
92
-
adb reverse tcp:9663 tcp:8080
93
-
adb reverse tcp:9664 tcp:8080
94
-
```
90
+
Simply follow the instructions in the flutter guide to install Xcode and the iOS
91
+
simulator.
95
92
96
-
#### Troubleshooting
93
+
#### Android
97
94
98
-
If Chrome instacrashes, it is likely you need to disable vulkan in emulator settings.
95
+
##### Troubleshooting
99
96
100
-
If you cannot access internet you can try launching the emulator with a DNS address:
97
+
-If Chrome crashes, it is likely you need to disable Vulkan in emulator settings:
101
98
102
-
```bash
103
-
$ emulator -avd <YourAVD> -dns-server 1.1.1.1
104
-
```
99
+
```bash
100
+
$ emulator -avd <YourAVD> -feature -Vulkan
101
+
```
105
102
106
-
If you experience high lags or freezes, check the memory settings and be sure to enable hardware acceleration (`-gpu host`)
107
-
Also disabling the snapshot storage may help:
103
+
You can read more about this issue [here](https://issuetracker.google.com/issues/277651135).
- If you cannot access internet you can try launching the emulator with a DNS address:
106
+
107
+
```bash
108
+
$ emulator -avd <YourAVD> -dns-server 1.1.1.1
109
+
```
110
+
111
+
If you are on Linux it seems that the emulator will try to read `/etc/resolv.conf` to find DNS servers.
112
+
You might want to check that your `/etc/resolv.conf` is configured properly rather than using the emulator `dns-server` flag first.
113
+
If you use systemd-resolved, the recommended mode of handling `/etc/resolv.conf` is to symlink `/etc/resolv.conf` to `/run/systemd/resolve/stub-resolv.conf`.
114
+
115
+
- If you experience high lags or freezes, check the memory settings and be sure to enable hardware acceleration (`-gpu host`).
- If you use Wayland, the emulator will not work. You can try to use Xwayland instead. The issue is tracked [here](https://issuetracker.google.com/issues/378421876).
112
124
113
125
## Code generation
114
126
@@ -132,26 +144,85 @@ dart run build_runner watch
132
144
133
145
Flutter comes with an `analyze` command to run static analysis. While developing you can run:
134
146
135
-
```
147
+
```bash
136
148
flutter analyze --watch
137
149
```
138
150
139
151
It will run analysis continuously, watching the filesystem for changes. It is important to always check for analysis errors.
140
152
141
153
## Run
142
154
143
-
Use the `flutter run` command to run on an emulator or device. If you need to change the lichess host you can do it like so:
155
+
Use the `flutter run` command to run the app on an emulator or a real device. If you need to change the lichess host you can do it like so:
144
156
157
+
```bash
158
+
flutter run \
159
+
--dart-define=LICHESS_HOST=lichess.dev \
160
+
--dart-define=LICHESS_WS_HOST=socket.lichess.org
145
161
```
146
-
flutter run --dart-define=LICHESS_HOST=lichess.dev
147
-
--dart-define=LICHESS_WS_HOST=socket.lichess.dev
162
+
163
+
> [!WARNING]
164
+
> Do not use any scheme (https:// or ws://) in url in host, since it's already handled by URI helper method
165
+
166
+
> [!NOTE]
167
+
> You can also use the production server but note that you will not be able to log in.
168
+
169
+
### Android
170
+
171
+
#### When using lila-docker
172
+
173
+
When using [lila-docker](https://github.com/lichess-org/lila-docker), the easiest solution is to use the adb reverse command:
174
+
175
+
```bash
176
+
adb reverse tcp:8080 tcp:8080
177
+
```
178
+
179
+
You can then run the app with the following hosts:
180
+
181
+
```bash
182
+
flutter run \
183
+
--dart-define=LICHESS_HOST=localhost:8080 \
184
+
--dart-define=LICHESS_WS_HOST=localhost:8080
148
185
```
149
186
187
+
Another option is to use the `./lila-docker hostname` command and select your computer's IP address.
188
+
189
+
You can then run the app with the following hosts:
0 commit comments