Skip to content

Commit 07913c2

Browse files
committed
docs(mobile): clean up Android README
1 parent b5ad3f9 commit 07913c2

1 file changed

Lines changed: 66 additions & 18 deletions

File tree

apps/mobile/android/README.md

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,111 @@
1-
# Android
1+
# DevCard Android
22

3-
Android native project for the DevCard React Native mobile app.
3+
Native Android project for the DevCard React Native app.
44

5-
## Prerequisites
5+
Use this folder for Android-specific Gradle builds, native configuration, emulator installs, and troubleshooting. For normal development, run commands from `apps/mobile` unless a command below says otherwise.
66

7-
- Node.js `>= 22.11.0`
8-
- Android Studio with Android SDK and emulator installed
9-
- Java version supported by the installed Android Gradle Plugin
10-
- Dependencies installed from `apps/mobile` with npm
11-
12-
## Run On Android
7+
## Quick Start
138

14-
From `apps/mobile`, start Metro in one terminal:
9+
Start Metro from `apps/mobile`:
1510

1611
```cmd
1712
npx react-native start --reset-cache
1813
```
1914

20-
In a second terminal, run the app:
15+
Open a second terminal and run the Android app:
2116

2217
```cmd
2318
cd /d D:\DC\apps\mobile
2419
npx react-native run-android -- --active-arch-only
2520
```
2621

27-
`--active-arch-only` keeps local emulator builds faster by building only the active emulator/device architecture.
22+
`--active-arch-only` builds only the connected emulator/device architecture, which is much faster during local development.
2823

29-
## Gradle Commands
24+
## Requirements
25+
26+
- Node.js `>= 22.11.0`
27+
- Android Studio with Android SDK and emulator support
28+
- Java version compatible with the Android Gradle Plugin used by this project
29+
- npm dependencies installed from `apps/mobile`
30+
- An Android emulator running, or a physical device connected with USB debugging enabled
3031

31-
Run these from `apps/mobile/android`:
32+
Install mobile dependencies from `apps/mobile`:
3233

3334
```cmd
34-
gradlew.bat app:packageDebug --stacktrace -PreactNativeArchitectures=x86_64
35+
npm install --legacy-peer-deps
36+
```
37+
38+
## Useful Gradle Commands
39+
40+
Run these from `apps/mobile/android`.
41+
42+
Build a debug APK:
43+
44+
```cmd
45+
gradlew.bat app:packageDebug -PreactNativeArchitectures=x86_64
3546
```
3647

48+
Install the debug build on a connected emulator/device:
49+
3750
```cmd
3851
gradlew.bat app:installDebug -PreactNativeArchitectures=x86_64
3952
```
4053

41-
The project currently sets `reactNativeArchitectures=x86_64` in `gradle.properties` for faster local Windows emulator builds. Use a CLI override when building for another device architecture, for example:
54+
Get detailed output for a failing build:
55+
56+
```cmd
57+
gradlew.bat app:packageDebug --stacktrace -PreactNativeArchitectures=x86_64
58+
```
59+
60+
## Architecture Builds
61+
62+
`gradle.properties` currently sets:
63+
64+
```properties
65+
reactNativeArchitectures=x86_64
66+
```
67+
68+
This keeps Windows emulator builds smaller and faster. Override it when targeting another device architecture:
4269

4370
```cmd
4471
gradlew.bat app:packageDebug -PreactNativeArchitectures=arm64-v8a
4572
```
4673

74+
Use all common Android ABIs only when needed:
75+
76+
```cmd
77+
gradlew.bat app:packageDebug -PreactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
78+
```
79+
4780
## Troubleshooting
4881

82+
### Metro Watches `D:\packages`
83+
4984
If Metro reports `ENOENT` for `D:\packages`, check `apps/mobile/metro.config.js`. The monorepo root should resolve to `D:\DC`, not `D:\`.
5085

51-
If Gradle fails at `:app:packageDebug`, rerun with `--stacktrace`:
86+
### Gradle Fails At `:app:packageDebug`
87+
88+
Rerun the package task with `--stacktrace` so the real error appears:
5289

5390
```cmd
5491
gradlew.bat app:packageDebug --stacktrace -PreactNativeArchitectures=x86_64
5592
```
5693

57-
If Android builds are very slow, avoid building all ABIs during local development. Use `--active-arch-only` through React Native CLI or pass `-PreactNativeArchitectures=x86_64` to Gradle.
94+
### Builds Are Slow
95+
96+
Use one of these faster local options:
97+
98+
- `npx react-native run-android -- --active-arch-only`
99+
- `gradlew.bat app:packageDebug -PreactNativeArchitectures=x86_64`
100+
101+
Avoid building every ABI unless you are preparing a broader test or release build.
102+
103+
### Windows Long Path Errors
58104

59105
If Windows reports paths longer than 260 characters, enable long paths from an Administrator PowerShell:
60106

61107
```powershell
62108
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
63109
```
110+
111+
Restart the terminal after changing this setting.

0 commit comments

Comments
 (0)