feat(build): add automated Android resource detection and generation
- Add generate-android-icons.sh script to create all required launcher icon sizes - Add check-android-resources.sh script to detect and fix missing Android resources - Integrate resource check into build-android.sh to prevent build failures - Fix splash screen resource naming (splash-dark.png -> splash_dark.png) - Add SplashScreen plugin configuration to capacitor.config.json - Automatically generate missing mipmap icons from assets/icon.png - Fix XML resource references to use correct drawable paths Author: Matthew Raymer SECURITY AUDIT CHECKLIST: - [x] No sensitive data exposed in generated resources - [x] Resource generation uses safe file operations - [x] Scripts include proper error handling and validation - [x] All generated files use appropriate permissions - [x] No hardcoded secrets or credentials in scripts
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# 6 - Capacitor sync failed
|
||||
# 7 - Asset generation failed
|
||||
# 8 - Android Studio launch failed
|
||||
# 9 - Resource check failed
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
@@ -37,26 +38,31 @@ setup_app_directories
|
||||
# Load environment from .env file if it exists
|
||||
load_env_file ".env"
|
||||
|
||||
# Step 1: Clean Android app
|
||||
# Step 1: Check and fix Android resources
|
||||
safe_execute "Checking Android resources" "$(dirname "$0")/check-android-resources.sh" || {
|
||||
log_warning "Resource check found issues, but continuing with build..."
|
||||
}
|
||||
|
||||
# Step 2: Clean Android app
|
||||
safe_execute "Cleaning Android app" "npm run clean:android" || exit 1
|
||||
|
||||
# Step 2: Clean dist directory
|
||||
# Step 3: Clean dist directory
|
||||
log_info "Cleaning dist directory..."
|
||||
clean_build_artifacts "dist"
|
||||
|
||||
# Step 3: Build Capacitor version
|
||||
# Step 4: Build Capacitor version
|
||||
safe_execute "Building Capacitor version" "npm run build:capacitor" || exit 3
|
||||
|
||||
# Step 4: Clean Gradle build
|
||||
# Step 5: Clean Gradle build
|
||||
safe_execute "Cleaning Gradle build" "cd android && ./gradlew clean && cd .." || exit 4
|
||||
|
||||
# Step 5: Assemble debug build
|
||||
# Step 6: Assemble debug build
|
||||
safe_execute "Assembling debug build" "cd android && ./gradlew assembleDebug && cd .." || exit 5
|
||||
|
||||
# Step 6: Sync with Capacitor
|
||||
# Step 7: Sync with Capacitor
|
||||
safe_execute "Syncing with Capacitor" "npx cap sync android" || exit 6
|
||||
|
||||
# Step 7: Generate assets and open Android Studio
|
||||
# Step 8: Generate assets and open Android Studio
|
||||
safe_execute "Generating assets" "npx capacitor-assets generate --android" || exit 7
|
||||
safe_execute "Opening Android Studio" "npx cap open android" || exit 8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user