Skip to content

Commit 4eb9820

Browse files
committed
Add CLAUDE.md with development workflow
Document the Android development loop including: - Build and install commands using Makefile - Log monitoring with adb logcat - Troubleshooting common issues - Makefile target reference
1 parent 5899cfc commit 4eb9820

1 file changed

Lines changed: 157 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Kolibri Android Development
2+
3+
This document provides the development workflow for the Kolibri Android app.
4+
5+
## Build System
6+
7+
This project uses a Makefile as the primary build interface. Run `make help` to see all available targets.
8+
9+
## Prerequisites
10+
11+
- Android emulator running OR physical device connected via ADB
12+
- Run `adb devices` to verify connection
13+
- If no emulator: `make setup && make emulator`
14+
15+
## Development Loop
16+
17+
### 1. Build and Install
18+
19+
Use the Makefile:
20+
```bash
21+
make install
22+
```
23+
24+
This runs `make kolibri.apk.unsigned` (builds debug APK) then installs via adb.
25+
26+
Or just build without installing:
27+
```bash
28+
make kolibri.apk.unsigned
29+
```
30+
31+
Watch for:
32+
- **BUILD SUCCESSFUL**: Proceed to install
33+
- **Compilation errors**: Fix before continuing
34+
- **Python errors**: Check Chaquopy output for syntax issues
35+
36+
### 2. Launch
37+
38+
```bash
39+
adb shell am start -n org.learningequality.Kolibri.debug/org.learningequality.Kolibri.WebViewActivity
40+
```
41+
42+
### 3. Monitor Logs
43+
44+
Use the Makefile target for filtered Kolibri logs:
45+
```bash
46+
make logcat
47+
```
48+
49+
Or for specific log types:
50+
51+
Python/Kolibri stdout/stderr:
52+
```bash
53+
adb logcat -s python.stdout:V python.stderr:V
54+
```
55+
56+
Specific component tags:
57+
```bash
58+
adb logcat -s KolibriWebView:V KolibriServer:V TaskWorkerImpl:V BaseTaskWorker:V
59+
```
60+
61+
Crash logs:
62+
```bash
63+
adb logcat -s AndroidRuntime:E
64+
```
65+
66+
### 4. Clear and Restart (when needed)
67+
68+
Uninstall app:
69+
```bash
70+
make uninstall
71+
```
72+
73+
Clear app data (preserves install):
74+
```bash
75+
adb shell pm clear org.learningequality.Kolibri.debug
76+
```
77+
78+
Force stop:
79+
```bash
80+
adb shell am force-stop org.learningequality.Kolibri.debug
81+
```
82+
83+
## Makefile Reference
84+
85+
| Target | Description |
86+
|--------|-------------|
87+
| `make setup` | Complete SDK + emulator setup (first time) |
88+
| `make emulator` | Start the emulator |
89+
| `make kolibri.apk.unsigned` | Build debug APK → dist/ |
90+
| `make install` | Build and install debug APK |
91+
| `make uninstall` | Uninstall app from device |
92+
| `make logcat` | View filtered Kolibri logs |
93+
| `make clean` | Clean build artifacts |
94+
| `make test` | Run unit tests |
95+
| `make lint` | Run Android linter |
96+
97+
## Quick Commands
98+
99+
Build + Install + Launch:
100+
```bash
101+
make install && adb shell am start -n org.learningequality.Kolibri.debug/org.learningequality.Kolibri.WebViewActivity
102+
```
103+
104+
Clear logs and monitor:
105+
```bash
106+
adb logcat -c && make logcat
107+
```
108+
109+
## Troubleshooting
110+
111+
### App crashes on startup
112+
1. Check crash logs: `adb logcat -s AndroidRuntime:E`
113+
2. Look for Python import errors: `adb logcat -s python.stderr:V`
114+
115+
### Python changes not appearing
116+
Chaquopy caches Python bytecode. Clear app data:
117+
```bash
118+
adb shell pm clear org.learningequality.Kolibri.debug
119+
```
120+
121+
Or uninstall and reinstall:
122+
```bash
123+
make uninstall && make install
124+
```
125+
126+
### INSTALL_FAILED_UPDATE_INCOMPATIBLE
127+
Signing key mismatch. Uninstall first:
128+
```bash
129+
make uninstall && make install
130+
```
131+
132+
### Service Worker issues
133+
1. Open Chrome DevTools: `chrome://inspect`
134+
2. Find the Kolibri WebView and inspect
135+
3. Check Application > Service Workers
136+
137+
### WorkManager tasks not running
138+
Check task logs:
139+
```bash
140+
adb logcat -s TaskWorkerImpl:V BaseTaskWorker:V WM-WorkerWrapper:V
141+
```
142+
143+
### Emulator not found
144+
```bash
145+
make setup # Creates SDK + AVD
146+
make emulator
147+
```
148+
149+
## Iterating
150+
151+
1. Make code changes
152+
2. `make install`
153+
3. Launch app and test
154+
4. `make logcat` in another terminal
155+
5. Repeat
156+
157+
For Python-only changes, builds are fast since Java doesn't need recompilation.

0 commit comments

Comments
 (0)