diff --git a/scripts/build-native.sh b/scripts/build-native.sh index 63b3ae0..33e3f9a 100755 --- a/scripts/build-native.sh +++ b/scripts/build-native.sh @@ -120,7 +120,14 @@ build_android() { log_info " Fix: Commenting out problematic 'apply from' line" # Apply the fix by commenting out the problematic line - sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle" + # Handle macOS vs Linux sed differences + if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS sed requires empty string after -i + sed -i '' 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle" + else + # Linux sed + sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle" + fi log_info "✅ Fix applied successfully" log_warn "⚠️ Note: This fix will be lost if you run 'npx cap sync' or 'npx cap update'" diff --git a/scripts/fix-capacitor-build.sh b/scripts/fix-capacitor-build.sh index 11bda70..cf03089 100755 --- a/scripts/fix-capacitor-build.sh +++ b/scripts/fix-capacitor-build.sh @@ -50,7 +50,14 @@ if [ -f "$CAPACITOR_BUILD_GRADLE" ]; then echo " Solution: Commenting out the problematic line" # Apply the fix by commenting out the problematic line - sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "$CAPACITOR_BUILD_GRADLE" + # Handle macOS vs Linux sed differences + if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS sed requires empty string after -i + sed -i '' 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "$CAPACITOR_BUILD_GRADLE" + else + # Linux sed + sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "$CAPACITOR_BUILD_GRADLE" + fi echo "✅ Fix applied successfully!" echo "💡 The problematic line has been commented out with an explanation"