Compare commits
2 Commits
ios-2
...
android-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e25841fe9 | ||
|
|
367325452a |
100
BUILDING.md
100
BUILDING.md
@@ -44,11 +44,9 @@ npx cap run android
|
||||
## Prerequisites
|
||||
|
||||
### Required Software
|
||||
- **Android Studio** (latest stable version) - for Android development
|
||||
- **Android Studio** (latest stable version)
|
||||
- **Java 11+** (for Kotlin compilation)
|
||||
- **Android SDK** with API level 21+
|
||||
- **Xcode** (latest stable version) - for iOS development (macOS only)
|
||||
- **Xcode Command Line Tools** - required for iOS builds (includes `xcodebuild`, `sqlite3`, etc.)
|
||||
- **Node.js** 16+ (for TypeScript compilation)
|
||||
- **npm** or **yarn** (for dependency management)
|
||||
|
||||
@@ -56,35 +54,11 @@ npx cap run android
|
||||
- **Gradle Wrapper** (included in project)
|
||||
- **Kotlin** (configured in build.gradle)
|
||||
- **TypeScript** (for plugin interface)
|
||||
- **CocoaPods** - for iOS dependency management
|
||||
|
||||
### iOS-Specific Prerequisites
|
||||
|
||||
**Xcode Command Line Tools** are required for iOS builds. The build script will verify these are installed:
|
||||
|
||||
```bash
|
||||
# Install Xcode Command Line Tools (if not already installed)
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
# Check if Command Line Tools are configured
|
||||
xcode-select -p
|
||||
|
||||
# Verify xcodebuild is available
|
||||
xcodebuild -version
|
||||
|
||||
# Verify sqlite3 is available (part of Command Line Tools)
|
||||
sqlite3 --version
|
||||
```
|
||||
|
||||
**Note:** The build script automatically checks for Command Line Tools and will fail with clear error messages if they're missing.
|
||||
|
||||
### System Requirements
|
||||
- **RAM**: 4GB minimum, 8GB recommended
|
||||
- **Storage**: 2GB free space
|
||||
- **OS**: Windows 10+, macOS 10.14+, or Linux (iOS development requires macOS)
|
||||
- **OS**: Windows 10+, macOS 10.14+, or Linux
|
||||
|
||||
## Build Methods
|
||||
|
||||
@@ -323,8 +297,6 @@ android/build/reports/tests/test/index.html
|
||||
|
||||
### iOS Native Build Process
|
||||
|
||||
**Prerequisites:** Ensure Xcode Command Line Tools are installed (see [Prerequisites](#prerequisites) section). The build script will verify this automatically.
|
||||
|
||||
#### 1. Navigate to iOS Directory
|
||||
```bash
|
||||
cd ios
|
||||
@@ -335,12 +307,6 @@ cd ios
|
||||
pod install
|
||||
```
|
||||
|
||||
**Note:** If you encounter issues with `pod install`, ensure Xcode Command Line Tools are properly configured:
|
||||
```bash
|
||||
xcode-select --install # Install if missing
|
||||
xcode-select -p # Verify installation path
|
||||
```
|
||||
|
||||
#### 3. Build Commands
|
||||
```bash
|
||||
# Build using Xcode command line
|
||||
@@ -816,13 +782,6 @@ The project includes several automated build scripts in the `scripts/` directory
|
||||
./scripts/build-native.sh --platform ios
|
||||
./scripts/build-native.sh --verbose
|
||||
|
||||
# Clean build (removes all build artifacts and caches)
|
||||
./scripts/clean-build.sh
|
||||
./scripts/clean-build.sh --all # Also cleans caches and reinstalls dependencies
|
||||
./scripts/clean-build.sh --clean-gradle-cache # Clean Gradle cache
|
||||
./scripts/clean-build.sh --clean-derived-data # Clean Xcode DerivedData
|
||||
./scripts/clean-build.sh --reinstall-node # Reinstall node_modules
|
||||
|
||||
# TimeSafari-specific builds
|
||||
node scripts/build-timesafari.js
|
||||
|
||||
@@ -989,28 +948,6 @@ adb logcat | grep DailyNotification
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Clean Build (First Step for Many Issues)
|
||||
|
||||
If you encounter persistent build issues, try a clean build first:
|
||||
|
||||
```bash
|
||||
# Clean all build artifacts (recommended first step)
|
||||
./scripts/clean-build.sh
|
||||
|
||||
# Clean everything including caches (for stubborn issues)
|
||||
./scripts/clean-build.sh --all
|
||||
|
||||
# Then rebuild
|
||||
./scripts/build-native.sh --platform all
|
||||
```
|
||||
|
||||
**When to use clean-build:**
|
||||
- Build errors that don't make sense
|
||||
- Dependency conflicts
|
||||
- Stale build artifacts
|
||||
- After switching branches
|
||||
- After updating dependencies
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### Gradle Sync Failures
|
||||
@@ -1082,39 +1019,6 @@ File → Project Structure → SDK Location
|
||||
# Solution: Check Kotlin version in build.gradle
|
||||
```
|
||||
|
||||
#### iOS Build Issues
|
||||
```bash
|
||||
# Problem: "Xcode Command Line Tools not configured"
|
||||
# Error: xcode-select -p fails or xcodebuild not found
|
||||
# Solution: Install Command Line Tools
|
||||
xcode-select --install
|
||||
|
||||
# Verify installation
|
||||
xcode-select -p
|
||||
xcodebuild -version
|
||||
sqlite3 --version
|
||||
|
||||
# Problem: "sqlite3 not found" or linker errors with SQLite
|
||||
# Solution: Ensure Command Line Tools are properly installed
|
||||
# The build script checks for this automatically, but if you see linker errors:
|
||||
xcode-select --install
|
||||
|
||||
# Problem: pkgx SQLite conflicts with iOS builds
|
||||
# Error: Linker errors about libsqlite3.dylib
|
||||
# Solution: The build script automatically handles this by unsetting problematic
|
||||
# environment variables. If issues persist:
|
||||
unset PKGX_DIR DYLD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
./scripts/build-native.sh --platform ios
|
||||
|
||||
# Problem: "pod install" fails
|
||||
# Solution: Ensure Command Line Tools are installed
|
||||
xcode-select --install
|
||||
# Then reinstall CocoaPods dependencies
|
||||
cd ios
|
||||
pod deintegrate
|
||||
pod install
|
||||
```
|
||||
|
||||
#### Capacitor Integration Issues
|
||||
```bash
|
||||
# Problem: Plugin not found in Capacitor app
|
||||
|
||||
@@ -1,46 +1,47 @@
|
||||
docs(building): update BUILDING.md with iOS prerequisites and clean-build script
|
||||
fix(build): add SQLite conflict detection and Command Line Tools verification
|
||||
|
||||
Updates BUILDING.md to reflect recent changes in build-native.sh, especially
|
||||
the Xcode Command Line Tools prerequisite check and the clean-build script.
|
||||
Prevents iOS build failures caused by pkgx SQLite linking conflicts and
|
||||
ensures Xcode Command Line Tools are properly installed.
|
||||
|
||||
Problem:
|
||||
- BUILDING.md didn't mention Xcode Command Line Tools prerequisite
|
||||
(recently added to build-native.sh)
|
||||
- clean-build.sh script exists but wasn't documented
|
||||
- iOS build troubleshooting lacked Command Line Tools guidance
|
||||
- pkgx installs SQLite built for macOS, causing linker errors when building
|
||||
for iOS simulator: "linking in dylib built for 'macOS'"
|
||||
- Missing Command Line Tools cause build failures without clear error messages
|
||||
|
||||
Changes:
|
||||
- Add Xcode Command Line Tools to Prerequisites section
|
||||
- Document installation command (xcode-select --install)
|
||||
- Include verification steps (xcode-select -p, xcodebuild -version)
|
||||
- Note that build script automatically checks for these tools
|
||||
- Explain that sqlite3 is part of Command Line Tools
|
||||
- Add check_sqlite_conflicts() function
|
||||
- Detects pkgx SQLite installations in ~/.pkgx
|
||||
- Warns about macOS dylibs that will cause iOS simulator build failures
|
||||
- Checks for system SQLite from Command Line Tools
|
||||
- Validates library paths (DYLD_LIBRARY_PATH, LD_LIBRARY_PATH)
|
||||
|
||||
- Document clean-build.sh script in Build Scripts section
|
||||
- Basic usage: ./scripts/clean-build.sh
|
||||
- All options: --all, --clean-gradle-cache, --clean-derived-data,
|
||||
--reinstall-node
|
||||
- Explain when to use clean builds
|
||||
- Add check_command_line_tools() function
|
||||
- Verifies Xcode Command Line Tools are installed and configured
|
||||
- Checks for xcodebuild availability
|
||||
- Verifies sqlite3 is available (part of Command Line Tools)
|
||||
- Provides clear error messages with installation instructions
|
||||
|
||||
- Enhance iOS Native Build Process section
|
||||
- Add prerequisite note about Command Line Tools
|
||||
- Include troubleshooting commands for pod install issues
|
||||
- Reference prerequisites section for details
|
||||
- Enhance pkgx detection in iOS build functions
|
||||
- Specifically searches for pkgx SQLite dylibs
|
||||
- Automatically removes pkgx paths from PATH environment variable
|
||||
- Provides detailed warnings about detected conflicts
|
||||
- Cleans all problematic environment variables before building
|
||||
|
||||
- Add comprehensive troubleshooting sections
|
||||
- Clean Build section at start of Troubleshooting
|
||||
- Recommends clean-build as first step for many issues
|
||||
- Lists when to use clean builds
|
||||
- iOS Build Issues section
|
||||
- Command Line Tools configuration errors
|
||||
- SQLite/linker issues and pkgx conflicts
|
||||
- CocoaPods installation problems
|
||||
- All with clear solutions and commands
|
||||
- Integrate checks into environment validation
|
||||
- Runs automatically when building for iOS
|
||||
- Provides early warnings before build starts
|
||||
- Fails fast with clear error messages if tools are missing
|
||||
|
||||
The documentation now accurately reflects:
|
||||
- Xcode Command Line Tools as required iOS prerequisite
|
||||
- clean-build.sh as available build tool
|
||||
- Complete iOS troubleshooting workflow
|
||||
This fixes the linker error:
|
||||
"ld: building for 'iOS-simulator', but linking in dylib
|
||||
(/Users/trent/.pkgx/sqlite.org/v3.44.2/lib/libsqlite3.0.dylib)
|
||||
built for 'macOS'"
|
||||
|
||||
The build script now:
|
||||
- Detects pkgx SQLite conflicts before building
|
||||
- Automatically fixes environment variables
|
||||
- Verifies Command Line Tools are installed
|
||||
- Provides clear guidance for manual fixes if needed
|
||||
|
||||
Files modified:
|
||||
- BUILDING.md
|
||||
- scripts/build-native.sh
|
||||
|
||||
@@ -12,6 +12,7 @@ package com.timesafari.dailynotification;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
@@ -154,9 +155,15 @@ public class DailyNotificationScheduler {
|
||||
cancelNotification(duplicateId);
|
||||
}
|
||||
|
||||
// Create intent for the notification
|
||||
Intent intent = new Intent(context, DailyNotificationReceiver.class);
|
||||
intent.setAction(com.timesafari.dailynotification.DailyNotificationConstants.ACTION_NOTIFICATION);
|
||||
// CRITICAL FIX: Explicitly set component and package for AlarmManager broadcasts
|
||||
// AlarmManager requires explicit component matching when delivering broadcasts
|
||||
ComponentName receiverComponent = new ComponentName(
|
||||
context.getPackageName(),
|
||||
"com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
);
|
||||
Intent intent = new Intent(com.timesafari.dailynotification.DailyNotificationConstants.ACTION_NOTIFICATION);
|
||||
intent.setComponent(receiverComponent);
|
||||
intent.setPackage(context.getPackageName());
|
||||
intent.putExtra(com.timesafari.dailynotification.DailyNotificationConstants.EXTRA_NOTIFICATION_ID, content.getId());
|
||||
|
||||
// Check if this is a static reminder
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
@@ -146,8 +147,15 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
// This prevents duplicate alarms when multiple scheduling paths race
|
||||
// Strategy: Check both by scheduleId (stable) and by trigger time (catches different scheduleIds for same time)
|
||||
val requestCode = getRequestCode(stableScheduleId)
|
||||
val checkIntent = Intent(context, com.timesafari.dailynotification.DailyNotificationReceiver::class.java).apply {
|
||||
action = "com.timesafari.daily.NOTIFICATION"
|
||||
// CRITICAL FIX: Explicitly set component and package for AlarmManager broadcasts
|
||||
// AlarmManager requires explicit component matching when delivering broadcasts
|
||||
val receiverComponent = ComponentName(
|
||||
context.packageName,
|
||||
"com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
)
|
||||
val checkIntent = Intent("com.timesafari.daily.NOTIFICATION").apply {
|
||||
setComponent(receiverComponent)
|
||||
setPackage(context.packageName)
|
||||
}
|
||||
|
||||
// Check 1: Same scheduleId (stable requestCode) - most reliable
|
||||
@@ -269,12 +277,21 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
Log.w(TAG, "Failed to store notification content in database, continuing with alarm scheduling", e)
|
||||
}
|
||||
|
||||
// FIX: Use DailyNotificationReceiver (registered in manifest) instead of NotifyReceiver
|
||||
// FIX: Set action to match manifest registration
|
||||
val intent = Intent(context, com.timesafari.dailynotification.DailyNotificationReceiver::class.java).apply {
|
||||
action = "com.timesafari.daily.NOTIFICATION" // Must match manifest intent-filter action
|
||||
putExtra("notification_id", notificationId) // DailyNotificationReceiver expects this extra
|
||||
putExtra("schedule_id", stableScheduleId) // Add stable scheduleId for tracking
|
||||
// CRITICAL FIX: Explicitly set component and package for AlarmManager broadcasts
|
||||
// AlarmManager requires explicit component matching when delivering broadcasts.
|
||||
// Using Intent(context, Class) constructor may not work reliably with AlarmManager
|
||||
// on all Android versions, especially when the app is in certain states.
|
||||
// Solution: Create Intent with action, then explicitly set component and package.
|
||||
val intent = Intent("com.timesafari.daily.NOTIFICATION").apply {
|
||||
// Explicitly set component to ensure AlarmManager can match it to the receiver
|
||||
setComponent(receiverComponent)
|
||||
// Explicitly set package to ensure it matches the app's package (not plugin's)
|
||||
setPackage(context.packageName)
|
||||
// Must match manifest intent-filter action
|
||||
// DailyNotificationReceiver expects this extra
|
||||
putExtra("notification_id", notificationId)
|
||||
// Add stable scheduleId for tracking
|
||||
putExtra("schedule_id", stableScheduleId)
|
||||
// Also preserve original extras for backward compatibility if needed
|
||||
putExtra("title", config.title)
|
||||
putExtra("body", config.body)
|
||||
@@ -282,7 +299,8 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
putExtra("vibration", config.vibration ?: true)
|
||||
putExtra("priority", config.priority ?: "normal")
|
||||
putExtra("is_static_reminder", isStaticReminder)
|
||||
putExtra("trigger_time", triggerAtMillis) // Store trigger time for debugging
|
||||
// Store trigger time for debugging
|
||||
putExtra("trigger_time", triggerAtMillis)
|
||||
if (reminderId != null) {
|
||||
putExtra("reminder_id", reminderId)
|
||||
}
|
||||
@@ -407,9 +425,14 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
*/
|
||||
fun cancelNotification(context: Context, scheduleId: String? = null, triggerAtMillis: Long? = null) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
// FIX: Use DailyNotificationReceiver to match what was scheduled
|
||||
val intent = Intent(context, com.timesafari.dailynotification.DailyNotificationReceiver::class.java).apply {
|
||||
action = "com.timesafari.daily.NOTIFICATION"
|
||||
// CRITICAL FIX: Use same Intent format as scheduling (explicit component and package)
|
||||
val receiverComponent = ComponentName(
|
||||
context.packageName,
|
||||
"com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
)
|
||||
val intent = Intent("com.timesafari.daily.NOTIFICATION").apply {
|
||||
setComponent(receiverComponent)
|
||||
setPackage(context.packageName)
|
||||
}
|
||||
val requestCode = when {
|
||||
scheduleId != null -> getRequestCode(scheduleId)
|
||||
@@ -438,9 +461,14 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
* @return true if alarm is scheduled, false otherwise
|
||||
*/
|
||||
fun isAlarmScheduled(context: Context, scheduleId: String? = null, triggerAtMillis: Long? = null): Boolean {
|
||||
// FIX: Use DailyNotificationReceiver to match what was scheduled
|
||||
val intent = Intent(context, com.timesafari.dailynotification.DailyNotificationReceiver::class.java).apply {
|
||||
action = "com.timesafari.daily.NOTIFICATION"
|
||||
// CRITICAL FIX: Use same Intent format as scheduling (explicit component and package)
|
||||
val receiverComponent = ComponentName(
|
||||
context.packageName,
|
||||
"com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
)
|
||||
val intent = Intent("com.timesafari.daily.NOTIFICATION").apply {
|
||||
setComponent(receiverComponent)
|
||||
setPackage(context.packageName)
|
||||
}
|
||||
val requestCode = when {
|
||||
scheduleId != null -> getRequestCode(scheduleId)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.timesafari.dailynotification
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
@@ -442,8 +443,14 @@ class ReactivationManager(private val context: Context) {
|
||||
return try {
|
||||
// Check if any PendingIntent for our receiver exists
|
||||
// This is more reliable than nextAlarmClock
|
||||
val intent = Intent(context, NotifyReceiver::class.java).apply {
|
||||
action = "com.timesafari.daily.NOTIFICATION"
|
||||
// CRITICAL FIX: Use DailyNotificationReceiver with explicit component/package
|
||||
val receiverComponent = ComponentName(
|
||||
context.packageName,
|
||||
"com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
)
|
||||
val intent = Intent("com.timesafari.daily.NOTIFICATION").apply {
|
||||
setComponent(receiverComponent)
|
||||
setPackage(context.packageName)
|
||||
}
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
|
||||
@@ -108,7 +108,8 @@ check_requirements() {
|
||||
# Check Android requirements if building Android
|
||||
if [ "$BUILD_ALL" = true ] || [ "$BUILD_ANDROID" = true ]; then
|
||||
if ! command -v adb &> /dev/null; then
|
||||
log_warn "Android SDK not found (adb not in PATH). Android build will be skipped."
|
||||
log_warn "Android SDK tools not found (adb not in PATH)."
|
||||
log_warn "APK can still be built, but install/launch requires adb."
|
||||
else
|
||||
log_info "✅ Android SDK: $(adb version | head -1)"
|
||||
fi
|
||||
@@ -238,18 +239,88 @@ if [ "$BUILD_ALL" = true ] || [ "$BUILD_IOS" = true ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find Android SDK location
|
||||
find_android_sdk() {
|
||||
local android_dir=""
|
||||
local local_props="$PROJECT_DIR/android/local.properties"
|
||||
|
||||
# Check environment variables first
|
||||
if [ -n "$ANDROID_HOME" ] && [ -d "$ANDROID_HOME" ]; then
|
||||
android_dir="$ANDROID_HOME"
|
||||
log_info "Found Android SDK via ANDROID_HOME: $android_dir"
|
||||
elif [ -n "$ANDROID_SDK_ROOT" ] && [ -d "$ANDROID_SDK_ROOT" ]; then
|
||||
android_dir="$ANDROID_SDK_ROOT"
|
||||
log_info "Found Android SDK via ANDROID_SDK_ROOT: $android_dir"
|
||||
fi
|
||||
|
||||
# Check existing local.properties
|
||||
if [ -z "$android_dir" ] && [ -f "$local_props" ]; then
|
||||
# Temporarily disable exit on error for grep (may not find match)
|
||||
set +e
|
||||
sdk_line=$(grep "^sdk.dir=" "$local_props" 2>/dev/null)
|
||||
set -e
|
||||
if [ -n "$sdk_line" ]; then
|
||||
android_dir=$(echo "$sdk_line" | cut -d'=' -f2 | sed 's|\\\\|/|g' | sed "s|^~|$HOME|")
|
||||
if [ -n "$android_dir" ] && [ -d "$android_dir" ]; then
|
||||
log_info "Found Android SDK in local.properties: $android_dir"
|
||||
else
|
||||
android_dir=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try common locations
|
||||
if [ -z "$android_dir" ]; then
|
||||
# macOS default location
|
||||
if [ -d "$HOME/Library/Android/sdk" ]; then
|
||||
android_dir="$HOME/Library/Android/sdk"
|
||||
log_info "Found Android SDK in default macOS location: $android_dir"
|
||||
# Linux default location
|
||||
elif [ -d "$HOME/Android/Sdk" ]; then
|
||||
android_dir="$HOME/Android/Sdk"
|
||||
log_info "Found Android SDK in default Linux location: $android_dir"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create/update local.properties if SDK found
|
||||
if [ -n "$android_dir" ]; then
|
||||
# Normalize path (convert to forward slashes, expand ~)
|
||||
android_dir=$(echo "$android_dir" | sed 's|\\\\|/|g' | sed "s|^~|$HOME|")
|
||||
|
||||
# Create local.properties with SDK location
|
||||
mkdir -p "$(dirname "$local_props")"
|
||||
echo "## This file is automatically generated by build script" > "$local_props"
|
||||
echo "## Location: $android_dir" >> "$local_props"
|
||||
echo "sdk.dir=$android_dir" >> "$local_props"
|
||||
log_info "✅ Configured Android SDK in local.properties"
|
||||
return 0
|
||||
else
|
||||
log_error "Android SDK not found!"
|
||||
log_error "Please set one of the following:"
|
||||
log_error " 1. ANDROID_HOME environment variable"
|
||||
log_error " 2. ANDROID_SDK_ROOT environment variable"
|
||||
log_error " 3. Create android/local.properties with: sdk.dir=/path/to/android/sdk"
|
||||
log_error ""
|
||||
log_error "Common SDK locations:"
|
||||
log_error " macOS: ~/Library/Android/sdk"
|
||||
log_error " Linux: ~/Android/Sdk"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Android build
|
||||
if [ "$BUILD_ALL" = true ] || [ "$BUILD_ANDROID" = true ]; then
|
||||
log_step "Building Android app..."
|
||||
|
||||
# Check for Android SDK
|
||||
if ! command -v adb &> /dev/null; then
|
||||
log_warn "adb not found. Android SDK may not be installed."
|
||||
log_warn "Skipping Android build. Install Android SDK to build Android."
|
||||
else
|
||||
# Ensure Android SDK is configured
|
||||
if ! find_android_sdk; then
|
||||
log_error "Cannot build Android app without SDK location"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$PROJECT_DIR/android"
|
||||
|
||||
# Build APK
|
||||
# Build APK (Gradle doesn't require adb for building)
|
||||
if ./gradlew :app:assembleDebug; then
|
||||
log_info "Android APK built successfully"
|
||||
|
||||
@@ -258,8 +329,15 @@ if [ "$BUILD_ALL" = true ] || [ "$BUILD_ANDROID" = true ]; then
|
||||
if [ -f "$APK_PATH" ]; then
|
||||
log_info "APK location: $APK_PATH"
|
||||
|
||||
# Run on emulator if requested
|
||||
# Run on emulator if requested (requires adb)
|
||||
if [ "$RUN_ALL" = true ] || [ "$RUN_ANDROID" = true ]; then
|
||||
# Check for Android SDK tools (adb)
|
||||
if ! command -v adb &> /dev/null; then
|
||||
log_warn "adb not found in PATH. Cannot install/launch app."
|
||||
log_warn "APK built successfully, but install/launch requires Android SDK."
|
||||
log_info "To install manually: adb install -r $APK_PATH"
|
||||
log_info "Or add Android SDK platform-tools to your PATH."
|
||||
else
|
||||
log_step "Installing and launching Android app..."
|
||||
|
||||
# Check for running emulator
|
||||
@@ -283,6 +361,7 @@ if [ "$BUILD_ALL" = true ] || [ "$BUILD_ANDROID" = true ]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_error "APK not found at expected location: $APK_PATH"
|
||||
fi
|
||||
@@ -292,7 +371,6 @@ if [ "$BUILD_ALL" = true ] || [ "$BUILD_ANDROID" = true ]; then
|
||||
fi
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
# iOS build
|
||||
|
||||
Reference in New Issue
Block a user