Browse Source

fix(assets): resolve Android and iOS resource generation issues

Android build was failing due to missing drawable and mipmap directories
for splash screens and launcher icons. iOS was missing complete asset
catalog structure for app icons and splash screens.

- Create missing Android resource directories (drawable, mipmap-*)
- Add splash screen files to Android drawable directory
- Generate complete set of Android launcher icons
- Create iOS asset catalog structure with proper Contents.json files
- Generate 21 iOS assets (app icons + splash screens) using ImageMagick
- Add resource validation scripts for both platforms
- Enhance Android resource check to auto-create missing directories

NOTE: you need to test this from a fresh clone and after an npm install!

Android build now completes successfully. iOS assets ready for macOS/Xcode
builds. Both platforms have complete resource sets for development.
pull/165/head
Matthew Raymer 5 days ago
parent
commit
45a8859a19
  1. 7
      android/app/src/main/res/values/colors.xml
  2. 23
      ios/App/App/Assets.xcassets/SplashDark.imageset/Contents.json
  3. BIN
      ios/App/App/Assets.xcassets/SplashDark.imageset/splash@1x.png
  4. BIN
      ios/App/App/Assets.xcassets/SplashDark.imageset/splash@2x.png
  5. BIN
      ios/App/App/Assets.xcassets/SplashDark.imageset/splash@3x.png
  6. 17
      scripts/check-android-resources.sh
  7. 294
      scripts/check-ios-resources.sh
  8. 253
      scripts/generate-ios-assets.sh

7
android/app/src/main/res/values/colors.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

23
ios/App/App/Assets.xcassets/SplashDark.imageset/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "splash@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "splash@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "splash@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
ios/App/App/Assets.xcassets/SplashDark.imageset/splash@1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
ios/App/App/Assets.xcassets/SplashDark.imageset/splash@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
ios/App/App/Assets.xcassets/SplashDark.imageset/splash@3x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

17
scripts/check-android-resources.sh

@ -45,6 +45,13 @@ issues_found=0
fixes_applied=0 fixes_applied=0
echo "[INFO] Checking splash screen resources..." echo "[INFO] Checking splash screen resources..."
# Ensure drawable directory exists
if [ ! -d "$ANDROID_RES_DIR/drawable" ]; then
echo "[FIX] Creating drawable directory..."
mkdir -p "$ANDROID_RES_DIR/drawable"
fixes_applied=$((fixes_applied + 1))
fi
# Check splash screen resources # Check splash screen resources
if ! check_file "$ANDROID_RES_DIR/drawable/splash.png" "Splash screen (light)"; then if ! check_file "$ANDROID_RES_DIR/drawable/splash.png" "Splash screen (light)"; then
if [ -f "$ASSETS_DIR/splash.png" ]; then if [ -f "$ASSETS_DIR/splash.png" ]; then
@ -67,6 +74,16 @@ if ! check_file "$ANDROID_RES_DIR/drawable/splash_dark.png" "Splash screen (dark
fi fi
echo "[INFO] Checking launcher icon resources..." echo "[INFO] Checking launcher icon resources..."
# Ensure mipmap directories exist
mipmap_dirs=("mdpi" "hdpi" "xhdpi" "xxhdpi" "xxxhdpi" "anydpi-v26")
for dir in "${mipmap_dirs[@]}"; do
if [ ! -d "$ANDROID_RES_DIR/mipmap-$dir" ]; then
echo "[FIX] Creating mipmap-$dir directory..."
mkdir -p "$ANDROID_RES_DIR/mipmap-$dir"
fixes_applied=$((fixes_applied + 1))
fi
done
# Check launcher icon resources # Check launcher icon resources
required_icons=( required_icons=(
"mipmap-mdpi/ic_launcher.png" "mipmap-mdpi/ic_launcher.png"

294
scripts/check-ios-resources.sh

@ -0,0 +1,294 @@
#!/bin/bash
# TimeSafari iOS Resource Check Script
# Checks for missing iOS resources and automatically fixes common issues
# Author: Matthew Raymer
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
IOS_ASSETS_DIR="$PROJECT_ROOT/ios/App/App/Assets.xcassets"
RESOURCES_DIR="$PROJECT_ROOT/resources/ios"
echo "=== TimeSafari iOS Resource Check ==="
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [INFO] Checking iOS resources"
# Function to check if a file exists
check_file() {
local file="$1"
local description="$2"
if [ -f "$file" ]; then
echo "[✓] $description: $file"
return 0
else
echo "[✗] $description: $file (MISSING)"
return 1
fi
}
# Function to check if a directory exists and has files
check_directory() {
local dir="$1"
local description="$2"
if [ -d "$dir" ] && [ "$(ls -A "$dir" 2>/dev/null)" ]; then
echo "[✓] $description: $dir"
return 0
else
echo "[✗] $description: $dir (MISSING OR EMPTY)"
return 1
fi
}
# Track issues
issues_found=0
fixes_applied=0
echo "[INFO] Checking iOS asset catalog structure..."
# Check if Assets.xcassets directory exists
if ! check_directory "$IOS_ASSETS_DIR" "iOS Assets.xcassets directory"; then
echo "[FIX] Creating iOS Assets.xcassets directory..."
mkdir -p "$IOS_ASSETS_DIR"
fixes_applied=$((fixes_applied + 1))
fi
# Check main Contents.json
if ! check_file "$IOS_ASSETS_DIR/Contents.json" "Main Assets.xcassets Contents.json"; then
echo "[FIX] Creating main Assets.xcassets Contents.json..."
cat > "$IOS_ASSETS_DIR/Contents.json" << 'EOF'
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
EOF
fixes_applied=$((fixes_applied + 1))
fi
echo "[INFO] Checking App Icon resources..."
# Check App Icon directory
if ! check_directory "$IOS_ASSETS_DIR/AppIcon.appiconset" "App Icon directory"; then
echo "[FIX] Creating App Icon directory..."
mkdir -p "$IOS_ASSETS_DIR/AppIcon.appiconset"
fixes_applied=$((fixes_applied + 1))
fi
# Check App Icon Contents.json
if ! check_file "$IOS_ASSETS_DIR/AppIcon.appiconset/Contents.json" "App Icon Contents.json"; then
echo "[FIX] Creating App Icon Contents.json..."
cat > "$IOS_ASSETS_DIR/AppIcon.appiconset/Contents.json" << 'EOF'
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
fixes_applied=$((fixes_applied + 1))
fi
echo "[INFO] Checking Splash Screen resources..."
# Check Splash directory
if ! check_directory "$IOS_ASSETS_DIR/Splash.imageset" "Splash screen directory"; then
echo "[FIX] Creating Splash screen directory..."
mkdir -p "$IOS_ASSETS_DIR/Splash.imageset"
fixes_applied=$((fixes_applied + 1))
fi
# Check Splash Contents.json
if ! check_file "$IOS_ASSETS_DIR/Splash.imageset/Contents.json" "Splash screen Contents.json"; then
echo "[FIX] Creating Splash screen Contents.json..."
cat > "$IOS_ASSETS_DIR/Splash.imageset/Contents.json" << 'EOF'
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
fixes_applied=$((fixes_applied + 1))
fi
# Check SplashDark directory
if ! check_directory "$IOS_ASSETS_DIR/SplashDark.imageset" "Dark splash screen directory"; then
echo "[FIX] Creating Dark splash screen directory..."
mkdir -p "$IOS_ASSETS_DIR/SplashDark.imageset"
fixes_applied=$((fixes_applied + 1))
fi
# Check SplashDark Contents.json
if ! check_file "$IOS_ASSETS_DIR/SplashDark.imageset/Contents.json" "Dark splash screen Contents.json"; then
echo "[FIX] Creating Dark splash screen Contents.json..."
cat > "$IOS_ASSETS_DIR/SplashDark.imageset/Contents.json" << 'EOF'
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
fixes_applied=$((fixes_applied + 1))
fi
echo "[INFO] Checking source resource files..."
# Check if source resources exist
if ! check_file "$RESOURCES_DIR/icon/icon.png" "iOS icon source"; then
issues_found=$((issues_found + 1))
fi
if ! check_file "$RESOURCES_DIR/splash/splash.png" "iOS splash source"; then
issues_found=$((issues_found + 1))
fi
if ! check_file "$RESOURCES_DIR/splash/splash_dark.png" "iOS dark splash source"; then
issues_found=$((issues_found + 1))
fi
echo "[INFO] Checking iOS platform status..."
# Check if iOS platform is properly initialized
if [ ! -d "$PROJECT_ROOT/ios" ]; then
echo "[ERROR] iOS platform directory not found"
issues_found=$((issues_found + 1))
elif [ ! -f "$PROJECT_ROOT/ios/App/App/Info.plist" ]; then
echo "[ERROR] Info.plist not found - platform may be corrupted"
issues_found=$((issues_found + 1))
else
echo "[✓] iOS platform appears to be properly initialized"
fi
# Summary
echo ""
echo "=== iOS Resource Check Summary ==="
if [ $issues_found -eq 0 ] && [ $fixes_applied -eq 0 ]; then
echo "[SUCCESS] All iOS resources are present and valid"
exit 0
elif [ $fixes_applied -gt 0 ]; then
echo "[SUCCESS] Fixed $fixes_applied resource issues automatically"
if [ $issues_found -gt 0 ]; then
echo "[WARNING] $issues_found issues remain that require manual attention"
echo "[NOTE] iOS builds require macOS with Xcode - cannot build on Linux"
exit 1
else
exit 0
fi
else
echo "[ERROR] Found $issues_found resource issues that require manual attention"
echo "[NOTE] iOS builds require macOS with Xcode - cannot build on Linux"
exit 1
fi

253
scripts/generate-ios-assets.sh

@ -0,0 +1,253 @@
#!/bin/bash
# TimeSafari iOS Asset Generation Script
# Manually generates iOS assets using ImageMagick when capacitor-assets fails
# Author: Matthew Raymer
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
IOS_ASSETS_DIR="$PROJECT_ROOT/ios/App/App/Assets.xcassets"
RESOURCES_DIR="$PROJECT_ROOT/resources/ios"
echo "=== TimeSafari iOS Asset Generation ==="
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [INFO] Generating iOS assets manually"
# Check if ImageMagick is available
if ! command -v convert &> /dev/null; then
echo "[ERROR] ImageMagick 'convert' command not found. Please install ImageMagick."
exit 1
fi
# Check if source files exist
if [ ! -f "$RESOURCES_DIR/icon/icon.png" ]; then
echo "[ERROR] Source icon not found: $RESOURCES_DIR/icon/icon.png"
exit 1
fi
if [ ! -f "$RESOURCES_DIR/splash/splash.png" ]; then
echo "[ERROR] Source splash not found: $RESOURCES_DIR/splash/splash.png"
exit 1
fi
if [ ! -f "$RESOURCES_DIR/splash/splash_dark.png" ]; then
echo "[ERROR] Source dark splash not found: $RESOURCES_DIR/splash/splash_dark.png"
exit 1
fi
echo "[INFO] Generating iOS app icons..."
# Generate app icons for different sizes
# iPhone icons
convert "$RESOURCES_DIR/icon/icon.png" -resize 40x40 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-20@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 60x60 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-20@3x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 58x58 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-29@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 87x87 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-29@3x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 80x80 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-40@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 120x120 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-40@3x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 120x120 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-60@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 180x180 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-60@3x.png"
# iPad icons
convert "$RESOURCES_DIR/icon/icon.png" -resize 20x20 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-20@1x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 40x40 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-20@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 29x29 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-29@1x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 58x58 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-29@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 40x40 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-40@1x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 80x80 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-40@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 152x152 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-76@2x.png"
convert "$RESOURCES_DIR/icon/icon.png" -resize 167x167 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-83.5@2x.png"
# App Store icon
convert "$RESOURCES_DIR/icon/icon.png" -resize 1024x1024 "$IOS_ASSETS_DIR/AppIcon.appiconset/AppIcon-1024@1x.png"
echo "[INFO] Generating iOS splash screens..."
# Generate splash screens for different scales
convert "$RESOURCES_DIR/splash/splash.png" -resize 320x480 "$IOS_ASSETS_DIR/Splash.imageset/splash@1x.png"
convert "$RESOURCES_DIR/splash/splash.png" -resize 640x960 "$IOS_ASSETS_DIR/Splash.imageset/splash@2x.png"
convert "$RESOURCES_DIR/splash/splash.png" -resize 960x1440 "$IOS_ASSETS_DIR/Splash.imageset/splash@3x.png"
# Generate dark splash screens
convert "$RESOURCES_DIR/splash/splash_dark.png" -resize 320x480 "$IOS_ASSETS_DIR/SplashDark.imageset/splash@1x.png"
convert "$RESOURCES_DIR/splash/splash_dark.png" -resize 640x960 "$IOS_ASSETS_DIR/SplashDark.imageset/splash@2x.png"
convert "$RESOURCES_DIR/splash/splash_dark.png" -resize 960x1440 "$IOS_ASSETS_DIR/SplashDark.imageset/splash@3x.png"
echo "[INFO] Updating Contents.json files to reference generated images..."
# Update AppIcon Contents.json to reference the generated files
cat > "$IOS_ASSETS_DIR/AppIcon.appiconset/Contents.json" << 'EOF'
{
"images" : [
{
"filename" : "AppIcon-20@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "AppIcon-20@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "AppIcon-29@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "AppIcon-29@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "AppIcon-40@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "AppIcon-40@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "AppIcon-60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "AppIcon-60@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "AppIcon-20@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "AppIcon-20@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "AppIcon-29@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "AppIcon-29@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "AppIcon-40@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "AppIcon-40@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "AppIcon-76@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "AppIcon-83.5@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "AppIcon-1024@1x.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
# Update Splash Contents.json to reference the generated files
cat > "$IOS_ASSETS_DIR/Splash.imageset/Contents.json" << 'EOF'
{
"images" : [
{
"filename" : "splash@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "splash@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "splash@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
# Update SplashDark Contents.json to reference the generated files
cat > "$IOS_ASSETS_DIR/SplashDark.imageset/Contents.json" << 'EOF'
{
"images" : [
{
"filename" : "splash@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "splash@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "splash@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
echo "[SUCCESS] iOS assets generated successfully!"
echo "[INFO] Generated files:"
find "$IOS_ASSETS_DIR" -name "*.png" | sort
echo ""
echo "[NOTE] iOS builds require macOS with Xcode - cannot build on Linux"
echo "[INFO] Assets are now ready for when you build on macOS"
Loading…
Cancel
Save