Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.json"
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["@typescript-eslint", "react", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"@typescript-eslint/no-explicit-any": "warn",
"react/react-in-jsx-scope": "off"
},
"ignorePatterns": [".docusaurus", "build", "node_modules"]
}
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:

- name: Install dependencies
run: npm ci
# Code quality checks
- name: Check code formatting
run: npm run format:check
- name: Run ESLint
run: npm run lint
# Fast validation tests first
- name: Run Fast Validation Tests
run: npm run test
Expand Down
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.docusaurus
build
package-lock.json
*.min.js

11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}

35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ npm run test
```

This validates:

- All `docId` references in `docusaurus.config.ts` point to existing files
- Internal markdown links are valid
- Configuration paths are correct
Expand Down Expand Up @@ -54,6 +55,38 @@ git push --no-verify

⚠️ **Note:** Even if you skip the hook, CI will still validate your changes and block deployment if validation fails.

## Code Quality

This project uses ESLint for linting and Prettier for code formatting to maintain consistent code style.

### Formatting

Format all files according to the Prettier configuration:

```bash
npm run format
```

Check if files are formatted correctly without modifying them:

```bash
npm run format:check
```

### Linting

Check for linting issues:

```bash
npm run lint
```

Automatically fix linting issues where possible:

```bash
npm run lint:fix
```

## Deployment

The website is deployed automatically using GitHub Actions when changes are pushed to the `main` branch. The deployment process:
Expand All @@ -62,4 +95,4 @@ The website is deployed automatically using GitHub Actions when changes are push
2. Runs full Docusaurus build
3. Deploys to GitHub Pages (only if all checks pass)

Broken links or validation errors will prevent deployment.
Broken links or validation errors will prevent deployment.
1 change: 0 additions & 1 deletion docs/For-developers/android/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
"description": "Android development setup and guides for ODE developers."
}
}

43 changes: 41 additions & 2 deletions docs/For-developers/android/adb-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This guide will walk you through setting up Android Debug Bridge (ADB) on your d
## What is ADB?

**Android Debug Bridge (ADB)** is a versatile command-line tool that lets you:

- Install and debug Android applications
- Access a Unix shell on your Android device
- Transfer files between your computer and device
Expand Down Expand Up @@ -45,6 +46,7 @@ export PATH=$PATH:$ANDROID_HOME/tools
```

4. Reload your shell configuration:

```bash
source ~/.zshrc # or source ~/.bash_profile
```
Expand Down Expand Up @@ -80,17 +82,20 @@ scoop install adb
#### Option 1: Using Package Manager

**Ubuntu/Debian:**

```bash
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot
```

**Fedora:**

```bash
sudo dnf install android-tools
```

**Arch Linux:**

```bash
sudo pacman -S android-tools
```
Expand All @@ -108,6 +113,7 @@ export PATH=$PATH:$ANDROID_HOME/tools
```

4. Reload your shell configuration:

```bash
source ~/.bashrc # or source ~/.zshrc
```
Expand All @@ -121,6 +127,7 @@ adb version
```

You should see output like:

```
Android Debug Bridge version 1.0.41
Version 33.0.3-8952118
Expand Down Expand Up @@ -158,12 +165,14 @@ adb devices
```

You should see output like:

```
List of devices attached
ABC123XYZ456 device
```

If you see `unauthorized` instead of `device`, you need to:

1. Check your device screen for the USB debugging authorization prompt
2. Tap **Allow** on the prompt
3. Run `adb devices` again
Expand All @@ -173,68 +182,81 @@ If you see `unauthorized` instead of `device`, you need to:
Here are some useful ADB commands for development:

### Check Connected Devices

```bash
adb devices
```

### Install an APK

```bash
adb install path/to/app.apk
```

This is particularly useful for installing Formulus APK files or other ODE applications for testing.

### Install with Replace (upgrade existing app)

```bash
adb install -r path/to/app.apk
```

### Uninstall an App

```bash
adb uninstall com.example.package
```

### View Device Logs

```bash
adb logcat
```

### Filter Logs by Tag

```bash
adb logcat -s TAG_NAME
```

### Clear Logs

```bash
adb logcat -c
```

### Pull File from Device

```bash
adb pull /sdcard/file.txt ~/Desktop/
```

### Push File to Device

```bash
adb push ~/Desktop/file.txt /sdcard/
```

### Open Shell on Device

```bash
adb shell
```

### Reboot Device

```bash
adb reboot
```

### Reboot to Bootloader

```bash
adb reboot bootloader
```

### Port Forwarding (Reverse)

```bash
adb reverse tcp:LOCAL_PORT tcp:DEVICE_PORT
```
Expand All @@ -248,6 +270,7 @@ This forwards a port from your Android device to your local machine. Very useful
**Issue:** `adb devices` shows no devices or shows `unauthorized`

**Solutions:**

1. **Check USB cable**: Try a different USB cable (some cables are charge-only)
2. **Check USB port**: Try a different USB port on your computer
3. **Check USB mode**: On your device, when connected, pull down the notification shade and ensure USB mode is set to **File Transfer** or **MTP** (not Charge only)
Expand All @@ -262,14 +285,16 @@ This forwards a port from your Android device to your local machine. Very useful
### macOS: "adb: command not found"

**Solution:** Make sure you've added ADB to your PATH and reloaded your shell:

```bash
echo 'export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools' >> ~/.zshrc
source ~/.zshrc
```

### Windows: "adb is not recognized"

**Solution:**
**Solution:**

1. Verify ADB is in your PATH by checking `C:\Android\sdk\platform-tools\adb.exe` exists
2. Open a **new** Command Prompt window (PATH changes require a new session)
3. Try the full path: `C:\Android\sdk\platform-tools\adb.exe devices`
Expand All @@ -279,22 +304,27 @@ source ~/.zshrc
**Solution:** Create a udev rule for your device:

1. Find your device's vendor ID:

```bash
lsusb
```

Look for your device and note the ID (e.g., `18d1:4ee2`)

2. Create a udev rule file:

```bash
sudo nano /etc/udev/rules.d/51-android.rules
```

3. Add a line (replace `18d1` with your vendor ID):

```
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="plugdev"
```

4. Set permissions:

```bash
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
Expand All @@ -310,6 +340,7 @@ source ~/.zshrc
### Device Shows as "Offline"

**Solutions:**

1. Disconnect and reconnect the USB cable
2. Restart ADB server:
```bash
Expand All @@ -335,6 +366,7 @@ For wireless debugging (Android 11+), you can connect via Wi-Fi:
## Next Steps

Now that ADB is set up, you can:

- Install and test Android applications
- Debug apps using `adb logcat`
- Transfer files between your computer and device
Expand All @@ -345,14 +377,17 @@ Now that ADB is set up, you can:
Once ADB is configured and your Android device is connected, you can develop Formulus using React Native:

1. **Navigate to the Formulus folder** in your terminal:

```bash
cd path/to/formulus
```

2. **Run the React Native app** on your connected Android device:

```bash
npx react-native run-android
```

This command will:
- Build the React Native app
- Install it on your connected Android device via ADB
Expand All @@ -373,14 +408,17 @@ When developing with ODE, you often need to connect Formulus running on your And
1. **Start your local Synkronus server** on your development machine (e.g., on port 8080)

2. **Forward the port** from your Android device to your local machine:

```bash
adb reverse tcp:8080 tcp:8080
```

This command forwards port 8080 on your Android device to port 8080 on your local machine.

3. **Configure Formulus** to use `http://localhost:8080` as the server URL. The app will connect to your local Synkronus server through the forwarded port.

**Example Workflow:**

```bash
# Terminal 1: Start Synkronus server locally
./synkronus # Running on localhost:8080
Expand All @@ -397,6 +435,7 @@ This setup allows you to develop and test the full ODE stack locally without dep
### Other ODE Development Tasks

For ODE-specific development, you can now:

- Install Formulus APK files for testing
- View logs from Synkronus server interactions
- Debug custom applications built with ODE
Expand All @@ -410,6 +449,6 @@ For ODE-specific development, you can now:
## Need Help?

If you encounter issues not covered here, please:

1. Check the [Android Developer Forums](https://developer.android.com/studio/intro/community)
2. Reach out to the ODE community at [hello@opendataensemble.org](mailto:hello@opendataensemble.org)

Loading