Ok, Finally my build is successful.
Actually you don’t have to worry about this whole FCMPlugin: Plugin install variables are not accessible, as package.json was unreachable/unreadable
thing.
If you go to your node modules -> cordova-plugin-fcm-with-dependency-updated -> src -> android -> FCMPlugin.gradlem,
you can see following dependencies section.
dependencies {
// Load system enviroment defined values, or, if unavailable, plugin defaults
def ANDROID_GOOGLE_SERVICES_VERSION = System.getenv('ANDROID_GOOGLE_SERVICES_VERSION') ?: '4.3.4'
def ANDROID_GRADLE_TOOLS_VERSION = System.getenv('ANDROID_GRADLE_TOOLS_VERSION') ?: '4.1.0'
try {
// Load configuration from install variables (package.json) two directories above
def PLUGIN_CONFIG = new groovy.json.JsonSlurper().parseText(file("${projectDir}/../../package.json").text).cordova.plugins['cordova-plugin-fcm-with-dependecy-updated']
ANDROID_GOOGLE_SERVICES_VERSION = PLUGIN_CONFIG.ANDROID_GOOGLE_SERVICES_VERSION
ANDROID_GRADLE_TOOLS_VERSION = PLUGIN_CONFIG.ANDROID_GRADLE_TOOLS_VERSION
} catch(Exception e0) {
try {
// Load configuration from install variables (package.json) three directories above
def PLUGIN_CONFIG = new groovy.json.JsonSlurper().parseText(file("${projectDir}/../../../package.json").text).cordova.plugins['cordova-plugin-fcm-with-dependecy-updated']
ANDROID_GOOGLE_SERVICES_VERSION = PLUGIN_CONFIG.ANDROID_GOOGLE_SERVICES_VERSION
ANDROID_GRADLE_TOOLS_VERSION = PLUGIN_CONFIG.ANDROID_GRADLE_TOOLS_VERSION
} catch(Exception e1) {
def WARNING_STYLE = "${(char)27}[33;49"+"m"
def DEFAULT_STYLE = "${(char)27}[39;49"+"m"
print(WARNING_STYLE+"FCMPlugin: Plugin install variables are not accessible, as package.json was unreachable/unreadable."+DEFAULT_STYLE)
}
}
// Override config with project values if available
ANDROID_GOOGLE_SERVICES_VERSION = rootProject.hasProperty('ANDROID_GOOGLE_SERVICES_VERSION') ? rootProject.ext.ANDROID_GOOGLE_SERVICES_VERSION : ANDROID_GOOGLE_SERVICES_VERSION
ANDROID_GRADLE_TOOLS_VERSION = rootProject.hasProperty('ANDROID_GRADLE_TOOLS_VERSION') ? rootProject.ext.ANDROID_GRADLE_TOOLS_VERSION : ANDROID_GRADLE_TOOLS_VERSION
// Avoid use "GRADLE_VERSION" because jitpack sets this like a environment variable
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_TOOLS_VERSION}"
classpath "com.google.gms:google-services:${ANDROID_GOOGLE_SERVICES_VERSION}"
}
In the try catch block there, you can see the error message that we are talking about.
If you read the whole section carefully, you can understand that the first line assigns a value to ANDROID_GOOGLE_SERVICES_VERSION
. If System env value is not available, the value ‘4.3.4’ is assigned to it.
The second line assigns 4.1.0 to ANDROID_GRADLE_TOOLS_VERSION
if the corresponding env value is not available.
the lines that follow above two lines check if the package.json contains values that should be assigned to them overriding the values that were assigned previously. (4.3.4 and 4.1.0)
But our package.json file does not contain those values. I dont know about the scenarios with cordova. But I am using capacitor. My Package.json file does not contain those values.
However, the code prints the error "FCMPlugin: Plugin install variables are not accessible, as package.json was unreachable/unreadable"
since it cannot find values from package.json file which we can safely ignore since we have already assigned values for them.
So, just ignore this. It works with this warning. You really don’t have to care.
Verified by installing the app in a real device. Push messages work fine. 
Don’t forget to place the google-services.json file in android -> app
directory.
Cheers !!