Giter Club home page Giter Club logo

cordova-support-google-services's Introduction

DEPRECATION NOTICE: no longer needed. Use preference GradlePluginGoogleServicesEnabled for cordova-android version 9 or higher.

Cordova plugin to add support for google services

NPM version NPM downloads Twitter

Donate Your help is appreciated. Create a PR, submit a bug or just grab me ๐Ÿบ

As part of enabling Google APIs or Firebase services in your Android application you may have to add the google-services plugin to your build.gradle file.

Index

Installation

cordova plugin add cordova-support-google-services --save

You also need to download google-services.json on Android and GoogleService-Info.plist on iOS from Firebase console and put them into the cordova project root folder. Then use <resource-file> to copy those files into appropriate folders:

<platform name="android">
    <resource-file src="google-services.json" target="app/google-services.json" />
    ...
</platform>
<platform name="ios">
    <resource-file src="GoogleService-Info.plist" />
    ...
</platform>

Note: if you use cordova-android below version 7 specify target="google-services.json" instead.

FAQ

Build Error: Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']

It looks like you have another dependency on a google play services lib with a generic verison *. You have to fix ALL dependency version(s) to be more more specific like 11.0.+. In order to do that fix version strings for any play services library you have in platforms/android/project.properties.

Build Error: Could not generate a proxy class for class com.google.gms.googleservices.GoogleServicesTask.

Open platform/android/build.gradle and change version of the first com.android.tools.build:gradle:

classpath 'com.android.tools.build:gradle:1.2.3+'

Duplicate resources: .../platforms/android/build/generated/res/google-services/armv7/debug/values/values.xml:string/google_api_key, .../platforms/android/res/values/strings.xml:string/google_api_key

Remove google_api_key and google_app_id from any existing xml file from platform/android/res/ folder. Those values now come from an automatically generated values.xml.

cordova-support-google-services's People

Contributors

chemerisuk avatar eric-fisher-resmed avatar luisegr avatar mingyiyangyarris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-support-google-services's Issues

Could not find google-services.json while looking in [src/nullnull/debug

On a brand new Cordova (8.0.0) project, having installed the Android platform (7.0.0), installed the google-support-google-services plugin (1.2.0), placed a google-services.json file in the project root, and adding the <resource-file> directive to config.xml, upon trying to build, I get

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]

Obviously, something is null which should not be--but what might that be, and where is it supposed to be set?

Is it relevant that $CORDOVA_HOME/platforms/android/app does not contain google-services.json, even though config.json contains

   <resource-file src="google-services.json" target="app/google-services.json" />

It is probably irrelevant, but I am also getting deprecation messages during the build, such as

publishNonDefault is deprecated and has no effect anymore. All variants are now published.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_bz6sxgr7c1apkp52ew2hx590z.run(/home/rtm/repos/nims/blue/cordova/platforms/android/app/build.gradle:144)
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

Are these messages related to some version issue with the Android SDK, perhaps?

Remove "apply plugin: com.google.gms.googleservices.GoogleServicesPlugin"

I have this issue by compiling...

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

The solution in FAQ is not functioning for me.

Info about "apply plugin: com.google.gms.googleservices.GoogleServicesPlugin"
dpa99c/cordova-plugin-request-location-accuracy#35 (comment)

Another fix
dpa99c/cordova-plugin-fcm@4940f83

I am using this plugin for play services now...
https://github.com/dpa99c/cordova-android-play-services-gradle-release

Error while executing cordova build android. Error: Duplicate resources

After following the instructions in readme.md, I received the following error:

BUILD FAILED in 5s
22 actionable tasks: 2 executed, 20 up-to-date
(node:30986) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /myAppCordova2/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> [string/google_app_id] /myAppCordova2/platforms/android/app/src/main/res/values/strings.xml        [string/google_app_id] /myAppCordova2/platforms/android/app/build/generated/res/google-services/debug/values/values.xml: Error: Duplicate resources
  [string/google_api_key] /myAppCordova2/platforms/android/app/src/main/res/values/strings.xml       [string/google_api_key] /myAppCordova2/platforms/android/app/build/generated/res/google-services/debug/values/values.xml: Error: Duplicate resources

My plugin list:

$ cordova plugin ls
cordova-plugin-firebase 1.0.5 "Google Firebase Plugin"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-support-google-services 1.2.0 "cordova-support-google-services"

Even removing the "google_api_key" and "google_app_id" items from the two values.xml and strings.xml files, the error reoccurs.

Dependency conflict

When I run:
cordova build android
I get the following:
What went wrong: A problem occurred configuring root project android. Cannot add task :processDebugGoogleServices' as a task with that name already exists.

I am attempting to use Firebase Analytics (cordova-plugin-firebase-analytics) which requires your plugin, Google Services (cordova-support-google-services). I am also using Firebase Cloud Messaging (cordova-plugin-fcm). The cordova-plugin-fcm includes Google Services 3.0.0 and the cordova-support-google-services has Google Services at 3.1.0 creating the conflict.

I am new to using Ionic 3/Angular 4. A fix I had found on a different forum, and implemented, was changing the version in platforms/android/cordova-support-google-services to 3.0.0 from 3.1.0. This was only a temporary fix, and a Sr. Dev on my team said this was terrible and should never be done. Of course, I do not want to do something that is a bad practice, however, what this error informed me of is that if I can get the dependencies at the same version, then the conflict resolves and the project builds.

Do you have an earlier plugin that has Google Services at 3.0.0 or is there a way to specify the version of Google Services at the time of installation? Any guidance you can offer would be extremely helpful.

Thank you!

Illformed requirement `"$POD_FIREBASE_VERSION"`

Hey there,

After updating this plugin to 2.1.4, I am getting this error when re-adding my IOS platform:
Illformed requirement "$POD_FIREBASE_VERSION"

I tried running ionic cordova plugin add cordova-plugin-firebase-messaging --POD_FIREBASE_VERSION 6.1.0, but it resulted in the same error.

Downgrading to 2.1.3 fixed it for me.

notification icon

how to change notification icon.?
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
but it doesnt change my icon

Input string: "+"

Hello,
I cant run my ionic 3/angular 4 and firebase project.
Error:

.../project_dir/platforms/android/cordova-support-google-services/salvanota-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"
    "dependencies": {
        "@angular/animations": "^4.0.0",
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/barcode-scanner": "^4.2.1",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/device": "^4.2.1",
        "@ionic-native/firebase-analytics": "^4.2.1",
        "@ionic-native/native-storage": "^4.3.0",
        "@ionic-native/social-sharing": "^4.2.1",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "2.0.1",
        "angularfire2": "^5.0.0-rc.3",
        "cordova-android": "^6.2.3",
        "cordova-android-support-gradle-release": "^1.1.5",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-console": "^1.1.0",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-firebase": "^0.1.24",
        "cordova-plugin-firebase-analytics": "^0.11.0",
        "cordova-plugin-nativestorage": "^2.2.2",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.3",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-x-socialsharing": "^5.2.1",
        "cordova-support-google-services": "^1.0.0",
        "css-animator": "^2.1.1",
        "es6-promise-plugin": "^4.1.0",
        "firebase": "^4.6.1",
        "ionic-angular": "3.6.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "phonegap-plugin-barcodescanner": "^6.0.8",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "web-animations-js": "^2.3.1",
        "zone.js": "0.8.12"
    }
  • ionic info
cli packages: (/usr/local/lib/node_modules)
    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:
    cordova (Cordova CLI) : 7.0.1 

local packages:
    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1

System:
    Android SDK Tools : 26.0.2
    Node              : v7.10.0
    npm               : 4.2.0 
    OS                : Linux 4.10

Environment Variables:
    ANDROID_HOME : /root/Android/Sdk

Misc:
    backend : legacy

missing google-services.json

Getting this error when building with Cordova Android 7.1.0
Going back to Android 6.4.0 has no issues.

The necessary google-services.json file is in the root directory.
In the config.xml

<platform name="android">
        <resource-file src="google-services.json" target="google-services.json" />
</platform>

The Error

Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
   Searched Location:
  myApp/platforms/android/app/src/nullnull/debug/google-services.json

  myApp/platforms/android/app/src/debug/nullnull/google-services.json
  myApp/platforms/android/app/src/nullnull/google-services.json
  myApp/platforms/android/app/src/debug/google-services.json

  myApp/platforms/android/app/src/nullnullDebug/google-services.json
  myApp/platforms/android/app/google-services.json

Faild to find AndroidManifest.xml

cordova version 8.0.0
android platform 7.0.1

when running cordova plugin add cordova-support-google-services i get the below error

Failed to install 'cordova-support-google-services': Error: ENOENT: no such file or directory, open 'path-to-my-project\platforms\android\AndroidManifest.xml'

where the path of androidManifest.xml is platforms/android/app/src/main

i am trying to install cordova-plugin-firebase-analytics that needs this plugin
im stuck in a situation where i cannot install this plugin if the android version is >= 7 and i cannot install cordova-plugin-firebase-analytics if the android version is less than 7

and this plugin is needed by the cordova-plugin-firebase-analytics plugin

thank you

void cannot be dereferenced

FirebaseMessagingPlugin.java:85: error: void cannot be dereferenced

Here's my build.gradle (app module)

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
*/

apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:4.1.0'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        mavenCentral();
        jcenter()
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.1.0'
}

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
ext {
    apply from: '../CordovaLib/cordova.gradle'
    // The value for android.compileSdkVersion.
    if (!project.hasProperty('cdvCompileSdkVersion')) {
        cdvCompileSdkVersion = null;
    }
    // The value for android.buildToolsVersion.
    if (!project.hasProperty('cdvBuildToolsVersion')) {
        cdvBuildToolsVersion = null;
    }
    // Sets the versionCode to the given value.
    if (!project.hasProperty('cdvVersionCode')) {
        cdvVersionCode = null
    }
    // Sets the minSdkVersion to the given value.
    if (!project.hasProperty('cdvMinSdkVersion')) {
        cdvMinSdkVersion = null
    }
    // Whether to build architecture-specific APKs.
    if (!project.hasProperty('cdvBuildMultipleApks')) {
        cdvBuildMultipleApks = null
    }
    // Whether to append a 0 "abi digit" to versionCode when only a single APK is build 
    if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) {
        cdvVersionCodeForceAbiDigit = null
    }
    // .properties files to use for release signing.
    if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
        cdvReleaseSigningPropertiesFile = null
    }
    // .properties files to use for debug signing.
    if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
        cdvDebugSigningPropertiesFile = null
    }
    // Set by build.js script.
    if (!project.hasProperty('cdvBuildArch')) {
        cdvBuildArch = null
    }

    // Plugin gradle extensions can append to this to have code run at the end.
    cdvPluginPostBuildExtras = []
}

// PLUGIN GRADLE EXTENSIONS START
apply from: "../cordova-plugin-buildinfo/my-BuildInfo.gradle"
apply from: "../cordova-plugin-browsertab/my-BrowserTab.gradle"
//apply from: "../cordova-support-google-services/my-build.gradle"
apply plugin: 'com.google.gms.google-services'
// PLUGIN GRADLE EXTENSIONS END

def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
    apply from: 'build-extras.gradle'
}

// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
    //ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion
}
if (ext.cdvBuildToolsVersion == null) {
    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
    //ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
}
if (ext.cdvDebugSigningPropertiesFile == null && file('../debug-signing.properties').exists()) {
    ext.cdvDebugSigningPropertiesFile = '../debug-signing.properties'
}
if (ext.cdvReleaseSigningPropertiesFile == null && file('../release-signing.properties').exists()) {
    ext.cdvReleaseSigningPropertiesFile = '../release-signing.properties'
}

// Cast to appropriate types.
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : defaultMinSdkVersion
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)

def computeBuildTargetName(debugBuild) {
    def ret = 'assemble'
    if (cdvBuildMultipleApks && cdvBuildArch) {
        def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch
        ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1);
    }
    return ret + (debugBuild ? 'Debug' : 'Release')
}

// Make cdvBuild a task that depends on the debug/arch-sepecific task.
task cdvBuildDebug
cdvBuildDebug.dependsOn {
    return computeBuildTargetName(true)
}

task cdvBuildRelease
cdvBuildRelease.dependsOn {
    return computeBuildTargetName(false)
}

task cdvPrintProps << {
    println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
    println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
    println('cdvVersionCode=' + cdvVersionCode)
    println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit)
    println('cdvMinSdkVersion=' + cdvMinSdkVersion)
    println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
    println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
    println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
    println('cdvBuildArch=' + cdvBuildArch)
    println('computedVersionCode=' + android.defaultConfig.versionCode)
    android.productFlavors.each { flavor ->
        println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
    }
}

android {

    defaultConfig {
        versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
        applicationId privateHelpers.extractStringFromManifest("package")

        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }
    }

    lintOptions {
      abortOnError false;
    }

    compileSdkVersion cdvCompileSdkVersion
    buildToolsVersion cdvBuildToolsVersion

    //This code exists for Crosswalk and other Native APIs.
    //By default, we multiply the existing version code in the Android Manifest by 10 and 
    //add a number for each architecture.  If you are not using Crosswalk or SQLite, you can
    //ignore this chunk of code, and your version codes will be respected.

    if (Boolean.valueOf(cdvBuildMultipleApks)) {
        flavorDimensions "default"

        productFlavors {
            armeabi {
                versionCode defaultConfig.versionCode*10 + 1
                ndk {
                    abiFilters = ["armeabi"]
                }
            }
            armv7 {
                versionCode defaultConfig.versionCode*10 + 2
                ndk {
                    abiFilters = ["armeabi-v7a"]
                }
            }
            arm64 {
                versionCode defaultConfig.versionCode*10 + 3
                ndk {
                    abiFilters = ["arm64-v8a"]
                }
            }
            x86 {
                versionCode defaultConfig.versionCode*10 + 4
                ndk {
                    abiFilters = ["x86"]
                }
            }
            x86_64 {
                versionCode defaultConfig.versionCode*10 + 5
                ndk {
                    abiFilters = ["x86_64"]
                }
            }
        }
    } else if (Boolean.valueOf(cdvVersionCodeForceAbiDigit)) {
        // This provides compatibility to the default logic for versionCode before cordova-android 5.2.0
        defaultConfig {
            versionCode defaultConfig.versionCode*10
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    if (cdvReleaseSigningPropertiesFile) {
        signingConfigs {
            release {
                // These must be set or Gradle will complain (even if they are overridden).
                keyAlias = ""
                keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
                storeFile = null
                storePassword = "__unset"
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
        }
        addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release)
    }
    if (cdvDebugSigningPropertiesFile) {
        addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug)
    }
}

/*
 * WARNING: Cordova Lib and platform scripts do management inside of this code here,
 * if you are adding the dependencies manually, do so outside the comments, otherwise
 * the Cordova tools will overwrite them
 */


dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    implementation 'com.google.firebase:firebase-core:16.0.3'
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: ":CordovaLib"))
    compile "com.android.support:customtabs:23.3.0"
    compile "com.google.firebase:firebase-messaging:17.3.+"
    compile "com.android.support:support-compat:27.+"
    compile "me.leolin:ShortcutBadger:1.1.17@aar"
    // SUB-PROJECT DEPENDENCIES END
}

def promptForReleaseKeyPassword() {
    if (!cdvReleaseSigningPropertiesFile) {
        return;
    }
    if ('__unset'.equals(android.signingConfigs.release.storePassword)) {
        android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ')
    }
    if ('__unset'.equals(android.signingConfigs.release.keyPassword)) {
        android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: ');
    }
}

gradle.taskGraph.whenReady { taskGraph ->
    taskGraph.getAllTasks().each() { task ->
      if(['validateReleaseSigning', 'validateSigningRelease', 'validateSigningArmv7Release', 'validateSigningX76Release'].contains(task.name)) {
         promptForReleaseKeyPassword()
      }
    }
}

def addSigningProps(propsFilePath, signingConfig) {
    def propsFile = file(propsFilePath)
    def props = new Properties()
    propsFile.withReader { reader ->
        props.load(reader)
    }

    def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile'))
    if (!storeFile.isAbsolute()) {
        storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile())
    }
    if (!storeFile.exists()) {
        throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath())
    }
    signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias')
    signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword))
    signingConfig.storeFile = storeFile
    signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword))
    def storeType = props.get('storeType', props.get('key.store.type', ''))
    if (!storeType) {
        def filename = storeFile.getName().toLowerCase();
        if (filename.endsWith('.p12') || filename.endsWith('.pfx')) {
            storeType = 'pkcs12'
        } else {
            storeType = signingConfig.storeType // "jks"
        }
    }
    signingConfig.storeType = storeType
}

for (def func : cdvPluginPostBuildExtras) {
    func()
}

// This can be defined within build-extras.gradle as:
//     ext.postBuildExtras = { ... code here ... }
if (hasProperty('postBuildExtras')) {
    postBuildExtras()
}

Gradle: Use cdvPluginPostBuildExtras instead of ext.postBuildExtras

Cordova Plugins should use cdvPluginPostBuildExtras (https://github.com/apache/cordova-android/blob/e9750b5cabe70b1fc9abfad28fd1239d9b9415c2/bin/templates/project/app/build.gradle#L90) to have code run at the end of the build gradle script instead of ext.postBuildExtras (https://github.com/apache/cordova-android/blob/e9750b5cabe70b1fc9abfad28fd1239d9b9415c2/bin/templates/project/app/build.gradle#L321). When multiple plugins use ext.postBuildExtras, each plugin will overwrite the previous plugin's assignment of it. The offending lines of code in this plugin are here:

ext.postBuildExtras = {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

trying to install cordova-support-google-services for android

I need to enable push notification on the platform I upgraded to cordova version 7.1.0. I removed the phonegap plugin-plugin to update it to the latest release, but when I try to add it, it comes back to me

"Installing "phonegap-plugin-push" for android
Plugin dependency "[email protected]" already fetched, using that version.
Installing "cordova-support-google-services" for android
Android Studio project detected
....
Error: ENOENT: no such file or directory, open '/platforms/android/app/src/main/assets/www/cordova_plugins.js' "

@chemerisuk @Junker How can I remove it and re-add it correctly?

Thanks

error in building PGB

hello I'm not able to use this plugin in my PGB project.
I removed all plugins but this one and I cannot build. The error is:

Could not find method google() for arguments [] on repository container

please help

build error

I have followed the faq solution when i get error

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
For input string: "+"

After that,i got the following error

  • What went wrong:
    Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.

Could not determine artifacts for com.facebook.android:facebook-common:4.39.0
Could not get resource 'https://jcenter.bintray.com/com/facebook/android/facebook-common/4.39.0/facebook-common-4.39.0.aar'.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-common/4.39.0/facebook-common-4.39.0.aar'.
> Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/99.84.87.62, d29vzk4ow07wi7.cloudfront.net/99.84.87.181, d29vzk4ow07wi7.cloudfront.net/99.84.87.80, d29vzk4ow07wi7.cloudfront.net/99.84.87.218] failed: Operation timed out (Connection timed out)

Issue while building for iOS

This is the error message I get from XCode when I try to build for iOS:

ld: library not found for -lFirebaseCore

Google Developer Api v3

Google needs us to use the version 3 of there API ...

Do this plugin use the latest version of Google Developer Api ?

Invalid google_app_id on Android

Hi there,
I've setup a Cordova app to use the cordova-plugin-firebase-analytics plugin (which uses this one). It's working fine for iOS but not Android. When I output the logs with adb logcat I get the following error:
01-02 13:54:57.322 E/FA (18325): Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id: 1046165292000
I've added the google-services.json file from the Firebase console and added the com.google.gms plugin line to my build.gradle file (in platforms/android). I'm honestly at a loss as to what to look at next.
Thanks,
Jason

Could not find play-services-measurement-base.aar (com.google.android.gms:play-services-measurement-base:15.0.2)

I'm suddenly getting this error after removing and readding the android platform:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find play-services-measurement-base.aar (com.google.android.gms:play-services-measurement-base:15.0.2).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-base/15.0.2/play-services-measurement
-base-15.0.2.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Picked up _JAVA_OPTIONS: -Xmx512M

I've already edited build.gradle as suggested in certain topics:

repositories {
	maven { url 'https://maven.google.com' }
        jcenter()
}

Is this needed if using androidx ?

If we're using android x do we need this plugin and all of the other ones like:
??

  •  "cordova-android-support-gradle-release": "3.0.1"
    
  • "cordova-support-android-plugin": "1.0.1",
    
  • "cordova-support-google-services": "1.3.1",
    

Could not find method google() for arguments [] on repository container

After installing the plugin as per instruction, when I run cordova build, build failed by showing below error.

platforms\android\cordova-support-google-services\xxxx-build.gradle' line: 3

  • What went wrong:
    A problem occurred evaluating script.

Could not find method google() for arguments [] on repository container.

This plugin can now be archieved

Thanks for this simple yet powerful plugin which has solved pain of many Cordova developers.

A new version of cordova-android (9.0.0) was released yesterday which now supports a configuration GoogleServicesVersion which can be added in config.xml to enable the GoogleServicesPlugin.

So considering this new setting, this plugin can be achieved and the same can be updated & conveyed via README.md.

The PR- https://github.com/apache/cordova-android/pull/893/files

Dependency failing

I have this error when i try to build:

Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[ 15.0.1], but play-services-basement version was 17.0.0.

How can i downgrade to 15.0.1 ? I try this without result:

cordova plugin add [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.