diff --git a/README.md b/README.md index aabd01e..5f12409 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,135 @@ -# communityapp +以下是根據你提供的資訊整理的 `README.md`,已加上標題、格式化及必要的提示,適合放在你的 Flutter 專案根目錄中: -A new Flutter project. +--- -## Getting Started +```markdown +# CommunityApp -This project is a starting point for a Flutter application. +本專案為使用 Flutter 開發的社區應用程式。 -A few resources to get you started if this is your first Flutter project: +--- -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) +## 🛠️ 開發環境安裝流程 -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +### 1. 安裝工具與開發環境 + +- 安裝 [Flutter SDK](https://flutter.dev/docs/get-started/install) +- 安裝 [Android Studio](https://developer.android.com/studio)(內含 Android 模擬器) +- (如需打包 iOS)安裝 Xcode(限 MacOS) +- 在 Android Studio 中安裝 Flutter Plugin +- 執行以下指令檢查環境設定是否正確: + +```bash +flutter doctor +``` + +--- + +### 2. 設定系統變數(加入 Flutter 至 PATH) + +- **Windows** + 控制台 → 環境變數 → 系統變數 → Path → 新增:`<你的 flutter 路徑>\bin` + +- **Mac/Linux** + 在 `~/.bashrc` 或 `~/.zshrc` 加入以下內容: + + ```bash + export PATH="$PATH:/你的/flutter/bin/路徑" + ``` + +--- + +### 3. 驗證安裝是否成功 + +```bash +flutter --version +flutter doctor +``` + +--- + +## 🐞 常見錯誤與解法 + +### ❗ cmdline-tools component is missing + +解法: + +1. 開啟 Android Studio +2. 選單:`Settings → Appearance & Behavior → System Settings → Android SDK` +3. 切到 `SDK Tools` 分頁 +4. 勾選 `Android SDK Command-line Tools (latest)` +5. 點選 Apply 安裝 + +--- + +### ❗ Android license status unknown + +解法: + +```bash +flutter doctor --android-licenses +``` + +出現授權條文時,請一律輸入 `y` 接受。 + +--- + +## 🚀 建立與執行專案 + +> ⚠️ 注意:資料夾與檔案名稱請勿含中文、空格或大寫! + +```bash +flutter create communityapp +cd communityapp +flutter run +``` + +執行後會看到 Flutter 的預設計數器 App 出現在模擬器上。 + +--- + +## 📦 打包 APK 並讓手機掃 QRCode 安裝 + +### 1. 建立 APK 檔案 + +```bash +flutter build apk --release +``` + +### 2. 啟動本機伺服器 + +```bash +cd build/app/outputs/flutter-apk +python -m http.server 8000 +``` + +### 3. 找出本機 IP + +```bash +ipconfig # Windows +ifconfig # Mac/Linux +``` + +記下你的 IP,例如 `192.168.1.100` + +### 4. 手機下載安裝 APK + +在手機瀏覽器輸入: + +``` +http://192.168.1.100:8000/app-release.apk +``` + +> 或者你也可以產生一個 QRCode,掃描後直接下載。建議使用網路工具或程式碼自動產生。 + +--- + +## 📝 備註 + +- 建議使用 Android 實機測試(模擬器有時會限制安裝 `.apk`) +- 可在 `pubspec.yaml` 自行新增套件與資源檔案 +``` + +--- + +如果你需要我幫你 **產生 QRCode 並放進網頁或 README 中**,也可以幫你加上!要嗎? \ No newline at end of file