Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Failed to apply plugin [id 'com.google.gms.google-services'] #97

Closed
ignaciolarranaga opened this issue Feb 11, 2017 · 11 comments
Closed
Labels

Comments

@ignaciolarranaga
Copy link

The build for Android start failing with this exception:

....
:config phase:  addAarDependencies
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Common-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Data-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/facebook-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/List-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Primitives-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/build.gradle' line: 802

* What went wrong:
A problem occurred evaluating root project 'ForSaleByOwner'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"
@AntonDobrev
Copy link
Contributor

@ignaciolarranaga

I suppose you are using one of the latest versions of the plugin - 0.1.0 or higher. Please note there is a difference between both - 0.1.1 automatically adds to your build gradle the google-services plugin with a + version.

What you can try on your side is:

  • set the push plugin as a dependency with the latest version (0.1.2)
  • tns platform remove android
  • tns platform add android
  • tns install

Build again.

Alternatively, edit the build.gradle and add to the class path where the google-services plugin is added 3.0.0 instead of +. Try building again.

I suspect that somewhere updating the project failed. Please try the above on your side and let me know how it goes.

@philippsander
Copy link

I had the same problem on 0.1.1

  • tns platform remove android
  • tns platform add android

resolve the issue

@ignaciolarranaga
Copy link
Author

mmm, add/remove the platform did not work for me. I tried even add/remove the plugin:

MacBook-Pro-de-Ignacio:hezea-app ignacio$ tns plugin add nativescript-push-notifications

> nativescript-push-notifications@0.1.2 postinstall /Users/ignacio/Workspaces/DuenoVende/hezea-app/node_modules/nativescript-push-notifications
> node postinstall.js

for-sale-by-owner@2.0.2 /Users/ignacio/Workspaces/DuenoVende/hezea-app
├── UNMET PEER DEPENDENCY @angular/compiler@2.4.3
├── UNMET PEER DEPENDENCY @angular/core@2.4.3
└── nativescript-push-notifications@0.1.2 


Successfully installed plugin nativescript-push-notifications.
MacBook-Pro-de-Ignacio:hezea-app ignacio$ tns prepare android
Copying template files...
  ◟ Installing tns-androidInstalling  tns-android
  ◟ Installing tns-androidfor-sale-by-owner@2.0.2 /Users/ignacio/Workspaces/DuenoVende/hezea-app
├── UNMET PEER DEPENDENCY @angular/compiler@2.4.3
├── UNMET PEER DEPENDENCY @angular/core@2.4.3
└── tns-android@2.5.0 


Project successfully created.
Executing before-prepare hook from /Users/ignacio/Workspaces/DuenoVende/hezea-app/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /Users/ignacio/Workspaces/DuenoVende/hezea-app/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
Executing before-prepare hook from /Users/ignacio/Workspaces/DuenoVende/hezea-app/hooks/before-prepare/nativescript-push-notifications.js
Preparing project...

:config phase:  createDefaultIncludeFiles

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Common-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Data-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/facebook-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/List-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Primitives-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/widgets-release.aar
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
Incremental java compilation is an incubating feature.
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 5.386 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin nativescript-facebook-login for android.
nativescript-fcuuid is not supported for android.
Successfully prepared plugin nativescript-fcuuid for android.
Successfully prepared plugin nativescript-fresco for android.
Successfully prepared plugin nativescript-google-analytics for android.
nativescript-iqkeyboardmanager is not supported for android.
Successfully prepared plugin nativescript-iqkeyboardmanager for android.
Successfully prepared plugin nativescript-phone for android.
Successfully prepared plugin nativescript-push-notifications for android.
Successfully prepared plugin nativescript-telerik-ui for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared (android)
Executing after-prepare hook from /Users/ignacio/Workspaces/DuenoVende/hezea-app/hooks/after-prepare/nativescript-dev-android-snapshot.js
MacBook-Pro-de-Ignacio:hezea-app ignacio$ tns run android
Skipping prepare.
Searching for devices...
Building project...

:config phase:  createDefaultIncludeFiles
	+found plugins: nativescript-facebook-login
	 + creating include.gradle file for /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-facebook-login
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-facebook-login -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F0
	+found plugins: nativescript-fresco
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-fresco -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F1
	+found plugins: nativescript-google-analytics
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-google-analytics -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F2
	+found plugins: nativescript-phone
	 + creating include.gradle file for /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-phone
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-phone -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F3
	+found plugins: nativescript-push-notifications
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-push-notifications -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F4
	+found plugins: nativescript-telerik-ui
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/nativescript-telerik-ui -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F5
	+found plugins: tns-core-modules-widgets
	 + creating include.gradle file for /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/tns-core-modules-widgets -> /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/src/F6

:config phase:  createPluginsConfigFile
	 Creating product flavors include.gradle file in /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations folder...

:config phase:  pluginExtend
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-facebook-login/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-fresco/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-google-analytics/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-phone/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-push-notifications/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-telerik-ui/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Common-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Data-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/facebook-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/List-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Primitives-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/build.gradle' line: 802

* What went wrong:
A problem occurred evaluating root project 'ForSaleByOwner'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"

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

BUILD FAILED

Total time: 4.298 secs
Command /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/gradlew failed with exit code 1
# run android

┌─────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage                   │ Synopsis                                                                                     │
│ Run on all connected    │ $ tns run android [--key-store-path <File Path> --key-store-password <Password> --key-store  │
│ devices and running     │ -alias <Name> --key-store-alias-password <Password>] [--release] [--justlaunch]              │
│ emulators               │                                                                                              │
│ Run on a selected       │ $ tns run android --device <Device ID> [--key-store-path <File Path> --key-store-password    │
│ connected device or     │ <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [-    │
│ running emulator        │ -justlaunch]                                                                                 │
│ Start an emulator and   │ $ tns run android --emulator [<Emulator Options>] [--key-store-path <File Path> --key-store  │
│ run the app inside it   │ -password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [-      │
│                         │ -release] [--justlaunch]                                                                     │
└─────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────┘

Runs your project on a connected Android device or in a native Android emulator, if configured. This is shorthand for prepare, build and deploy. While your app is running, prints the output from the application in the console and watches for changes in your code. Once a change is detected, it synchronizes the change with all selected devices and restarts/refreshes the application.

### Options

    * --no-watch - If set, changes in your code will not be reflected during the execution of this command.
    * --device - Specifies a connected device/emulator on which to run the app.
    * --emulator - If set, runs the app in a native emulator for the target platform, if configured. When set, you can also set any other valid combination of emulator options as listed by $ tns help emulate android.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --justlaunch - If set, does not print the application output in the console.
    * --clean - If set, forces rebuilding the native application.

### Attributes

    * <Device ID> is the index or name of the target device as listed by $ tns device android
    * <Emulator Options> is any valid combination of options as listed by $ tns help emulate android

Sending exception report (press Ctrl+C to stop).....

@philippsander
Copy link

Alternatively, edit the build.gradle and add to the class path where the google-services plugin is added 3.0.0 instead of +. Try building again.

did you do that?

@ignaciolarranaga
Copy link
Author

Yep, and it did not work either, but I think something else might be wrong, because despite I changed the version it keeps saying the same, might it be a hook or another plugin interfering ?:

MacBook-Pro-de-Ignacio:hezea-app ignacio$ head -n 30 /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/build.gradle | tail
import groovy.json.JsonSlurper //used to parse package.json
buildscript {
    repositories {
        jcenter()
    }

	dependencies {
		classpath "com.google.gms:google-services:3.0.0"
		classpath "com.android.tools.build:gradle:2.1.2"
	}
MacBook-Pro-de-Ignacio:hezea-app ignacio$ tns run android
Skipping prepare.
Searching for devices...
Building project...

:config phase:  createDefaultIncludeFiles
	+found plugins: nativescript-facebook-login
	+found plugins: nativescript-fresco
	+found plugins: nativescript-google-analytics
	+found plugins: nativescript-phone
	+found plugins: nativescript-push-notifications
	+found plugins: nativescript-telerik-ui
	+found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
	 Creating product flavors include.gradle file in /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations folder...

:config phase:  pluginExtend
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-facebook-login/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-fresco/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-google-analytics/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-phone/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-push-notifications/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/nativescript-telerik-ui/include.gradle
	+applying configuration from: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Common-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Data-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/facebook-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/List-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/Primitives-2017.1.201-dev-release.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ignacio/Workspaces/DuenoVende/hezea-app/platforms/android/build.gradle' line: 802

* What went wrong:
A problem occurred evaluating root project 'ForSaleByOwner'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"

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

BUILD FAILED

@ignaciolarranaga
Copy link
Author

ignaciolarranaga commented Feb 14, 2017

Got it!, I think the problem were the hooks not actually the platform.
I removed the hooks folder and the compilation worked. May be a cache there ?

@AntonDobrev
Copy link
Contributor

@ignaciolarranaga I just reproduced the problem. However, for me the problem was solved with the suggestion for adding/removing platforms. I had the new plugin added after the android platform was initialized. Then the build failed with the same exception. I am using {N} 2.5.

The issue you described, however, really sounds like some cache/hooks problem (given the plugin now uses a hook). Let me know if there is a new information on the case.

Closing the issue for now.

@ignaciolarranaga
Copy link
Author

ignaciolarranaga commented Feb 16, 2017

@AntonDobrev just to comment I had to delete the node_modules and once rebuild it, the hook started executing again together with the problem, so I guess the hook is doing something wrong.
The problem was the same, it starts saying:

Failed to apply plugin [id 'com.google.gms.google-services']
For input string: "+"

I deleted the hook reference from /hooks and the compilation backs to the normal.

@ignaciolarranaga
Copy link
Author

Actually just realized that the compilation pass but the application failed at runtime:

02-16 06:12:55.885 3506-3506/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.hezea.ForSaleByOwner, PID: 3506
                                                 java.lang.NoSuchMethodError: No static method zzdD(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzv; or its super classes (declaration of 'com.google.android.gms.common.util.zzv' appears in /data/app/com.hezea.ForSaleByOwner-1/base.apk)
                                                     at com.google.firebase.FirebaseOptions.<init>(Unknown Source)
                                                     at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
                                                     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)

@ignaciolarranaga
Copy link
Author

I got the reproduction from scratch, the problem arise when used together with nativescript-google-analytics (I guess because both use firebase), checkout out here: #101

@vats28
Copy link

vats28 commented Sep 17, 2017

Remove "Google Analytics" plugin..
remove platform android and add again
if it show firebase related error then go into AndroidStudio > SDK > AndroidRepositories and update
it should done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants