← Back to chrisbanes/cheesesquare

How to Deploy & Use chrisbanes/cheesesquare

Cheesesquare Deployment & Usage Guide

A comprehensive guide for building and running the Cheesesquare demo application, which showcases the Android Design Library components including Collapsing Toolbar, FloatingActionButton, NavigationView, and Snackbar.

1. Prerequisites

Required Software

  • Android Studio: Latest stable version (Arctic Fox or newer recommended)
  • JDK: Version 8 or 11 (OpenJDK or Oracle JDK)
  • Git: For cloning the repository
  • Android SDK:
    • SDK Platform API 22+ (Android 5.1)
    • Android SDK Build-Tools 30.0.0 or newer
    • Android Support Repository (legacy) or AndroidX libraries (modern)

Hardware Requirements

  • Emulator: x86_64 system image with hardware acceleration (HAXM or Hypervisor)
  • Physical Device: Android 5.1+ (API 22) device with USB debugging enabled

2. Installation

Clone the Repository

git clone https://github.com/chrisbanes/cheesesquare.git
cd cheesesquare

Open in Android Studio

  1. Launch Android Studio
  2. Select File > Open and navigate to the cheesesquare directory
  3. Click OK to open the project

Sync Project

Android Studio will automatically prompt to sync Gradle. If not:

  • Click File > Sync Project with Gradle Files
  • Or click the "Sync Now" banner if it appears

3. Configuration

This demo application requires no external API keys or environment variables. However, you may need to configure the following:

Gradle Configuration (Optional)

If behind a corporate proxy, edit gradle.properties:

systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=8080

Signing Configuration (For Release Builds)

Create app/keystore.properties (do not commit to version control):

storePassword=your_store_password
keyPassword=your_key_password
keyAlias=your_key_alias
storeFile=path/to/your/keystore.jks

4. Build & Run

Debug Build (Development)

Command Line:

./gradlew assembleDebug

APK location: app/build/outputs/apk/debug/app-debug.apk

Android Studio:

  1. Select Run > Run 'app' (or press Shift+F10)
  2. Choose target device (emulator or connected device)
  3. Click OK

Install Directly to Device

./gradlew installDebug

Release Build (Production)

./gradlew assembleRelease

APK location: app/build/outputs/apk/release/app-release-unsigned.apk

Note: For a signed release build, ensure you have configured signing keys in build.gradle or via keystore.properties.

Android App Bundle (AAB) for Play Store

./gradlew bundleRelease

Output: app/build/outputs/bundle/release/app-release.aab

5. Deployment

Sideloading (Testing)

Transfer the APK to device and install:

adb install app/build/outputs/apk/debug/app-debug.apk

Or use Android Studio's "Run" button for automatic deployment.

Google Play Store

  1. Generate signed AAB: ./gradlew bundleRelease
  2. Log in to Google Play Console
  3. Create new application or select existing
  4. Navigate to Production > Create new release
  5. Upload app-release.aab
  6. Complete store listing and submit for review

Firebase App Distribution (Beta Testing)

./gradlew assembleRelease
firebase appdistribution:distribute app/build/outputs/apk/release/app-release.apk \
  --app 1:1234567890:android:0a1b2c3d4e5f6789 \
  --release-notes "Cheesesquare demo build" \
  --testers "testers@example.com"

6. Troubleshooting

Gradle Sync Failed

Issue: Could not find com.android.tools.build:gradle:x.x.x Solution: Update Android Gradle Plugin in build.gradle (project level):

classpath 'com.android.tools.build:gradle:7.0.0' // or latest

SDK Not Found

Issue: SDK location not found Solution: Create local.properties in project root:

sdk.dir=/path/to/your/Android/Sdk

Or set ANDROID_HOME environment variable.

Build Tools Version Mismatch

Issue: The SDK Build Tools revision (xx.x.x) is too low Solution: Update build.gradle (app level):

android {
    buildToolsVersion "30.0.3" // or latest
}

Or remove buildToolsVersion to use default.

Kotlin Version Conflict

Issue: Kotlin plugin version mismatch Solution: Ensure Kotlin version matches in build.gradle (project):

ext.kotlin_version = '1.5.21' // or latest stable
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Installation Failed (Device)

Issue: INSTALL_FAILED_UPDATE_INCOMPATIBLE Solution: Uninstall existing app first:

adb uninstall com.support.android.designlibdemo

Then retry installation.

OutOfMemoryError During Build

Issue: java.lang.OutOfMemoryError: GC overhead limit exceeded Solution: Increase heap size in gradle.properties:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8