A basic Android app to test the development workflow with GitHub, Codemagic, Codespaces, and Firebase.
- Simple counter that increments when you tap a button
- Firebase Analytics integration to track user interactions
- Firebase Firestore integration to save counter values
- Clean Material Design UI
-
Go to Firebase Console
-
Create a new project or use an existing one
-
Add an Android app to your Firebase project:
- Package name:
com.testapp.simplefirebaseapp - Download the
google-services.jsonfile - Place it in
app/google-services.json
- Package name:
-
Enable Firebase Analytics and Firestore in your Firebase Console
# Clone the repository
git clone <your-repo-url>
cd SimpleFirebaseApp
# Build the project
./gradlew build
# Run on connected device or emulator
./gradlew installDebug- Create a new GitHub repository
- Push this code to GitHub:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin <your-repo-url>
git push -u origin main- In your GitHub repository, click "Code" → "Codespaces" → "Create codespace on main"
- Codespaces will automatically set up a development environment
- Install Android SDK if needed in the codespace
- Sign in to Codemagic
- Connect your GitHub repository
- Create a
codemagic.yamlconfiguration file (see below) - Configure build triggers and environment variables
workflows:
android-workflow:
name: Android Workflow
max_build_duration: 60
environment:
groups:
- firebase
vars:
PACKAGE_NAME: "com.testapp.simplefirebaseapp"
scripts:
- name: Set up local.properties
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/local.properties"
- name: Build Android app
script: |
./gradlew assembleDebug
artifacts:
- app/build/outputs/**/*.apk
publishing:
firebase:
firebase_service_account: $FIREBASE_SERVICE_ACCOUNT
android:
app_id: $FIREBASE_APP_IDSet these in Codemagic:
FIREBASE_SERVICE_ACCOUNT: Your Firebase service account JSONFIREBASE_APP_ID: Your Firebase Android app ID
SimpleFirebaseApp/
├── app/
│ ├── src/
│ │ └── main/
│ │ ├── java/com/testapp/simplefirebaseapp/
│ │ │ └── MainActivity.java
│ │ ├── res/
│ │ │ ├── layout/
│ │ │ │ └── activity_main.xml
│ │ │ └── values/
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── themes.xml
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ └── google-services.json (you need to add this)
├── build.gradle
├── settings.gradle
└── README.md
- Local Development: Build and run the app locally
- GitHub: Push changes to trigger version control
- Codespaces: Use cloud-based development environment
- Codemagic: Automated builds on push
- Firebase: View analytics and Firestore data in Firebase Console
- Add more Firebase features (Authentication, Cloud Functions, etc.)
- Set up automated testing
- Configure release builds with signing
- Add deployment to Google Play Store