Skip to content

Commit 390eced

Browse files
committed
Update build.gradle
1 parent a5373aa commit 390eced

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

android/app/build.gradle

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,24 @@ dependencies {
5656

5757
apply from: 'capacitor.build.gradle'
5858

59+
// Google Services plugin - only apply if file exists and has content
60+
// This is wrapped in multiple safety checks to prevent CI failures
5961
try {
6062
def servicesJSON = file('google-services.json')
61-
if (servicesJSON.exists() && servicesJSON.text) {
62-
apply plugin: 'com.google.gms.google-services'
63-
logger.info("google-services.json found, applying Google Services plugin")
63+
if (servicesJSON != null && servicesJSON.exists() && servicesJSON.length() > 0) {
64+
try {
65+
// Additional safety check - ensure the plugin is available in classpath
66+
apply plugin: 'com.google.gms.google-services'
67+
println("✓ Google Services plugin applied successfully")
68+
} catch (Exception pluginError) {
69+
println("⚠ Google Services plugin not available or failed to apply: ${pluginError.message}")
70+
println(" This is not a critical error - the app will build without push notifications")
71+
}
6472
} else {
65-
logger.info("google-services.json not found or empty, Google Services plugin not applied. Push Notifications won't work")
73+
println("ℹ google-services.json not found - building without Google Services")
74+
println(" Push notifications will not be available, but this is not an error")
6675
}
6776
} catch(Exception e) {
68-
logger.info("Error checking google-services.json: ${e.message}. Google Services plugin not applied")
77+
println("ℹ Google Services check failed: ${e.message}")
78+
println(" Continuing build without Google Services - this is not a critical error")
6979
}

0 commit comments

Comments
 (0)