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'] when used together with nativescript-google-analytics #101

Closed
ignaciolarranaga opened this issue Feb 16, 2017 · 7 comments

Comments

@ignaciolarranaga
Copy link

ignaciolarranaga commented Feb 16, 2017

Hi I noticed both plugins generate some conflict when used together, and not sure which one is the best to log the issue or the most appropriate to make and adjustment/suggestion ?

Sorry for the inconvenience if the problem is related to the google-analytics plugin.

The problem as the title says is the version of google-services.
For reproduction:

tns create Sample --ng
cd Sample
tns plugin add nativescript-google-analytics
tns plugin add nativescript-push-notifications
cp ...../google-services.json app/App_Resources/Android/
tns run android

and you will get:

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

Here is the complete trace:

MacBook-Pro-de-Ignacio:tmp ignacio$ tns create Sample --ng
Installing  tns-template-hello-world-ng
/private/tmp/Sample
└─┬ tns-template-hello-world-ng@2.5.0 
  ├── @angular/common@2.4.3 
  ├── @angular/compiler@2.4.3 
  ├── @angular/core@2.4.3 
  ├── @angular/forms@2.4.3 
  ├── @angular/http@2.4.3 
  ├── @angular/platform-browser@2.4.3 
  ├── @angular/platform-browser-dynamic@2.4.3 
  ├── @angular/router@3.4.3 
  ├─┬ nativescript-angular@1.4.0 
  │ ├── nativescript-intl@0.0.10 
  │ ├── parse5@1.3.2 
  │ ├── punycode@1.3.2 
  │ ├── querystring@0.2.0 
  │ ├── url@0.10.3 
  │ └── UNMET PEER DEPENDENCY zone.js@^0.7.2
  ├── nativescript-theme-core@1.0.2 
  ├── reflect-metadata@0.1.9 
  ├─┬ rxjs@5.0.3 
  │ └── symbol-observable@1.0.4 
  └── UNMET PEER DEPENDENCY zone.js@^0.7.2


/private/tmp/Sample
└─┬ tns-core-modules@2.5.0 
  └── tns-core-modules-widgets@2.5.0 



> nativescript-dev-android-snapshot@0.0.6 postinstall /private/tmp/Sample/node_modules/nativescript-dev-android-snapshot
> node postinstall.js


> nativescript-dev-typescript@0.3.7 postinstall /private/tmp/Sample/node_modules/nativescript-dev-typescript
> node postinstall.js

Project already targets TypeScript ~2.1.0
/private/tmp/Sample
├─┬ nativescript-dev-android-snapshot@0.0.6 
│ ├── adm-zip@0.4.7 
│ ├─┬ nativescript-hook@0.2.1 
│ │ ├─┬ glob@6.0.4 
│ │ │ ├─┬ inflight@1.0.6 
│ │ │ │ └── wrappy@1.0.2 
│ │ │ ├── inherits@2.0.3 
│ │ │ ├─┬ minimatch@3.0.3 
│ │ │ │ └─┬ brace-expansion@1.1.6 
│ │ │ │   ├── balanced-match@0.4.2 
│ │ │ │   └── concat-map@0.0.1 
│ │ │ ├── once@1.4.0 
│ │ │ └── path-is-absolute@1.0.1 
│ │ └─┬ mkdirp@0.5.1 
│ │   └── minimist@0.0.8 
│ ├── semver@5.3.0 
│ └── shelljs@0.6.1 
├── nativescript-dev-typescript@0.3.7 
├── typescript@2.1.6 
└── zone.js@0.7.7 


Project Sample was successfully created.

MacBook-Pro-de-Ignacio:tmp ignacio$ cd Sample/
MacBook-Pro-de-Ignacio:Sample ignacio$ tns plugin add nativescript-google-analytics
/private/tmp/Sample
└── nativescript-google-analytics@0.3.5 


Successfully installed plugin nativescript-google-analytics.
MacBook-Pro-de-Ignacio:Sample ignacio$ tns plugin add nativescript-push-notifications

> nativescript-push-notifications@0.1.2 postinstall /private/tmp/Sample/node_modules/nativescript-push-notifications
> node postinstall.js

/private/tmp/Sample
└── nativescript-push-notifications@0.1.2 


Successfully installed plugin nativescript-push-notifications.
MacBook-Pro-de-Ignacio:Sample ignacio$ cp /Users/ignacio/Workspaces/DuenoVende/hezea-app/app/App_Resources/Android/google-services.json app/App_Resources/Android/
MacBook-Pro-de-Ignacio:Sample ignacio$ tns run android
Copying template files...
  ◞ Installing tns-androidInstalling  tns-android
  ◝ Installing tns-android/private/tmp/Sample
└── tns-android@2.5.0 


  ◠ Installing tns-android/private/tmp/Sample
└─┬ babel-traverse@6.23.1 
  ├─┬ babel-code-frame@6.22.0 
  │ ├─┬ chalk@1.1.3 
  │ │ ├── ansi-styles@2.2.1 
  │ │ ├── escape-string-regexp@1.0.5 
  │ │ ├─┬ has-ansi@2.0.0 
  │ │ │ └── ansi-regex@2.1.1 
  │ │ ├── strip-ansi@3.0.1 
  │ │ └── supports-color@2.0.0 
  │ ├── esutils@2.0.2 
  │ └── js-tokens@3.0.1 
  ├── babel-messages@6.23.0 
  ├─┬ babel-runtime@6.23.0 
  │ ├── core-js@2.4.1 
  │ └── regenerator-runtime@0.10.1 
  ├─┬ babel-types@6.23.0 
  │ └── to-fast-properties@1.0.2 
  ├── babylon@6.15.0 
  ├─┬ debug@2.6.1 
  │ └── ms@0.7.2 
  ├── globals@9.15.0 
  ├─┬ invariant@2.2.2 
  │ └── loose-envify@1.3.1 
  └── lodash@4.17.4 


  ◜ Installing tns-android/private/tmp/Sample
└── babel-types@6.23.0 


  ◜ Installing tns-android/private/tmp/Sample
└── babylon@6.15.0 


  ◜ Installing tns-android/private/tmp/Sample
└── lazy@1.0.11 


Project successfully created.
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-push-notifications.js
Preparing project...

:config phase:  createDefaultIncludeFiles

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/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: 6.062 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-google-analytics for android.
Successfully prepared plugin nativescript-push-notifications 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 /private/tmp/Sample/hooks/after-prepare/nativescript-dev-android-snapshot.js
Searching for devices...
Building project...

:config phase:  createDefaultIncludeFiles
	+found plugins: nativescript-google-analytics
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/nativescript-google-analytics -> /private/tmp/Sample/platforms/android/src/F0
	+found plugins: nativescript-push-notifications
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/nativescript-push-notifications -> /private/tmp/Sample/platforms/android/src/F1
	+found plugins: tns-core-modules-widgets
	 + creating include.gradle file for /private/tmp/Sample/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/tns-core-modules-widgets -> /private/tmp/Sample/platforms/android/src/F2

:config phase:  createPluginsConfigFile
	 Creating product flavors include.gradle file in /private/tmp/Sample/platforms/android/configurations folder...

:config phase:  pluginExtend
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/nativescript-google-analytics/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/nativescript-push-notifications/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/private/tmp/Sample/platforms/android/build.gradle' line: 802

* What went wrong:
A problem occurred evaluating root project 'Sample'.
> 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: 3.916 secs
Command /private/tmp/Sample/platforms/android/gradlew failed with exit code 1
# run android

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

I think the problem might be related to this, but just guessing:

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/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.
@ignaciolarranaga
Copy link
Author

Link to the google analytics plugin issue also reported: sitefinitysteve/nativescript-google-analytics#29

@ignaciolarranaga
Copy link
Author

Closed in favor of sitefinitysteve/nativescript-google-analytics#29
The issue seems more related to their build process.

@ignaciolarranaga
Copy link
Author

As per sitefinitysteve/nativescript-google-analytics#29 is something to correct on your side guys.

@Daxito
Copy link

Daxito commented Feb 18, 2017

Isn't this related to EddyVerbruggen/nativescript-plugin-firebase#163 ?

@ignaciolarranaga
Copy link
Author

I guess so @Daxito, so by removing the sections mentioned on #80 and #105 and adding:

android {  
  // other stuff here

  project.ext {
    googlePlayServicesVersion = "10.0.+"
  }
}

as mentioned here https://github.com/EddyVerbruggen/nativescript-plugin-firebase#includegradle-failed-to-apply-plugin--for-input-string- should work correctly right ?
Thanks for the help by the way!!

@Daxito
Copy link

Daxito commented Feb 20, 2017

Yes! Give it a try! I don't have any other Google Play Services (like google maps), just the PushNotifications stuff.

@NKDM44
Copy link

NKDM44 commented Jun 29, 2017

I had the same problem, but in my case there was another plugin with dependencies:
[..]compile 'com.google.android.gms:play-services-location:+'

Just replaced + with 11.0.1 and everything was fine

Btw. exec android: ../tools/bin/sdkmanger --update for the latest

@lini lini closed this as completed Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants