Enhance Makefile, README, and setup script for improved development workflow
- Updated Makefile to include new setup commands for Android SDK and emulator management. - Revised README.md to reflect changes in setup instructions and command usage. - Introduced setup.sh script for one-time environment setup, including SDK installation and configuration. - Modified CrklAccessibilityService to implement a floating action button instead of a full-screen overlay. - Enhanced OverlayView to support toggling between button and overlay modes for gesture capture. - Adjusted accessibility service configuration to disable touch exploration mode for better user experience.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Crkl - Physical Phone Development
|
||||
.PHONY: help build install run stop logs clean uninstall
|
||||
.PHONY: help setup-sdk build install run stop logs clean uninstall devices check-device
|
||||
|
||||
ANDROID_HOME ?= $(HOME)/android-sdk
|
||||
ADB := $(ANDROID_HOME)/platform-tools/adb
|
||||
@@ -7,10 +7,22 @@ GRADLEW := ./gradlew
|
||||
APK := app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
help: ## Show available commands
|
||||
@echo "Crkl - Physical Phone Commands"
|
||||
@echo "Crkl - Android Development Commands"
|
||||
@echo ""
|
||||
@echo "Setup Commands:"
|
||||
@echo " make setup-sdk - Install Android SDK and tools"
|
||||
@echo " make setup-emulator - Create and start Android emulator"
|
||||
@echo " make check-device - Check if device/emulator is connected"
|
||||
@echo " make devices - List connected devices/emulators"
|
||||
@echo ""
|
||||
@echo "Emulator Commands:"
|
||||
@echo " make emulator - Start Android emulator"
|
||||
@echo " make emulator-stop - Stop emulator"
|
||||
@echo " make emulator-list - List available emulators"
|
||||
@echo ""
|
||||
@echo "Development Commands:"
|
||||
@echo " make build - Build APK"
|
||||
@echo " make install - Install to phone"
|
||||
@echo " make install - Install to device/emulator"
|
||||
@echo " make run - Launch app"
|
||||
@echo " make logs - Watch app logs"
|
||||
@echo " make stop - Stop app"
|
||||
@@ -18,28 +30,99 @@ help: ## Show available commands
|
||||
@echo " make uninstall - Remove app"
|
||||
@echo ""
|
||||
|
||||
setup-sdk: ## Install Android SDK and tools
|
||||
@echo "Setting up Android SDK..."
|
||||
@mkdir -p $(ANDROID_HOME)
|
||||
@cd $(ANDROID_HOME) && \
|
||||
if [ ! -f cmdline-tools/latest/bin/sdkmanager ]; then \
|
||||
echo "Downloading Android SDK command-line tools..."; \
|
||||
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip; \
|
||||
unzip -q commandlinetools-linux-11076708_latest.zip; \
|
||||
mkdir -p cmdline-tools/latest; \
|
||||
mv cmdline-tools/* cmdline-tools/latest/ 2>/dev/null || true; \
|
||||
rm commandlinetools-linux-11076708_latest.zip; \
|
||||
fi
|
||||
@echo "Accepting SDK licenses..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
yes | sdkmanager --licenses > /dev/null 2>&1
|
||||
@echo "Installing platform tools and build tools..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" > /dev/null 2>&1
|
||||
@echo "✓ Android SDK setup complete!"
|
||||
@echo "Add to your ~/.bashrc or ~/.zshrc:"
|
||||
@echo " export ANDROID_HOME=$(ANDROID_HOME)"
|
||||
@echo " export PATH=\$$ANDROID_HOME/platform-tools:\$$PATH"
|
||||
|
||||
check-device: ## Check if device is connected
|
||||
@echo "Checking for connected devices..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
adb devices
|
||||
|
||||
devices: check-device ## List connected devices (alias for check-device)
|
||||
|
||||
setup-emulator: ## Create and start Android emulator
|
||||
@echo "Setting up Android emulator..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
sdkmanager "system-images;android-34;google_apis;x86_64" > /dev/null 2>&1
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
avdmanager create avd -n "CrklEmulator" -k "system-images;android-34;google_apis;x86_64" -d "pixel_7" --force
|
||||
@echo "✓ Emulator created. Run 'make emulator' to start it."
|
||||
|
||||
emulator: ## Start Android emulator
|
||||
@echo "Starting Android emulator with 4GB RAM..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/emulator:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
emulator -avd CrklEmulator -memory 4096 -cores 4 -no-audio -gpu swiftshader_indirect -no-metrics &
|
||||
|
||||
emulator-stop: ## Stop emulator
|
||||
@echo "Stopping emulator..."
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
adb emu kill
|
||||
|
||||
emulator-list: ## List available emulators
|
||||
@echo "Available emulators:"
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
avdmanager list avd
|
||||
|
||||
build: ## Build APK
|
||||
@echo "Building Crkl..."
|
||||
@$(GRADLEW) assembleDebug
|
||||
|
||||
install: build ## Install to phone
|
||||
@echo "Installing to phone..."
|
||||
@$(ADB) install -r $(APK)
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
$(ADB) install -r $(APK)
|
||||
@echo "✓ Installed"
|
||||
|
||||
run: ## Launch app
|
||||
@echo "Launching Crkl..."
|
||||
@$(ADB) shell am start -n com.example.crkl/.MainActivity
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
$(ADB) shell am start -n com.example.crkl/.MainActivity
|
||||
|
||||
logs: ## Watch app logs
|
||||
@echo "Watching logs (Ctrl+C to stop)..."
|
||||
@$(ADB) logcat -s CrklAccessibilityService:D OverlayView:D AndroidRuntime:E
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
$(ADB) logcat -s CrklAccessibilityService:D OverlayView:D AndroidRuntime:E
|
||||
|
||||
stop: ## Stop app
|
||||
@$(ADB) shell am force-stop com.example.crkl
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
$(ADB) shell am force-stop com.example.crkl
|
||||
|
||||
clean: ## Clean build
|
||||
@$(GRADLEW) clean
|
||||
|
||||
uninstall: ## Remove app
|
||||
@$(ADB) uninstall com.example.crkl
|
||||
@export ANDROID_HOME=$(ANDROID_HOME) && \
|
||||
export PATH=$(ANDROID_HOME)/platform-tools:$$PATH && \
|
||||
$(ADB) uninstall com.example.crkl
|
||||
|
||||
Reference in New Issue
Block a user