phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Error on cordova build android --release #2780

Open omahjoub opened 5 years ago

omahjoub commented 5 years ago

Hi all, any help will be appreciated, thx.

Expected Behaviour

Android build is ok

Actual Behaviour

Android build fails The build is ok when i remove the phonegap-plugin-push

Reproduce Scenario (including but not limited to)

Platform and Version

Ionic:

   Ionic CLI                     : 5.0.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.5.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 16 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.2

System:

   Android SDK Tools : 26.1.1 (/xxx/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v12.4.0 (/usr/local/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001 

Plugin version

2.2.3

Logs taken while reproducing problem

* Where:
Script '/xxx/platforms/android/cordova-support-google-services/dabchyapp-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

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

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
/xxx/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script '/xxx/platforms/android/cordova-support-google-services/dabchyapp-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

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

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android --release exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Installed Plugins In Package JSON

"cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-facebook4": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-badge": {},
      "phonegap-plugin-push": {
        "SENDER_ID": "x:xxxxxxxxxx:android:xxxxxxx"
      },
      "cordova-plugin-network-information": {},
      "com-sarriaroman-photoviewer": {},
      "cordova-plugin-certificates": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-mixpanel": {},
      "cordova-support-google-services": {}
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
erisu commented 5 years ago

@omahjoub I had not been able to reproduce your issue.

Can you create from a clean project a minimum reproducible repo of this issue? (with steps)

Steps I took

  1. Create Project, Add Platform, Add Plugin
    cordova create androidTest com.foobar.androidTest androidTest && $_
    cordova platform add android
    cordova plugin add phonegap-plugin-push

Here is a part of my package.json after executing the commands above.

"dependencies": {
    "cordova-android": "^8.0.0",
    "cordova-support-google-services": "^1.1.0",
    "phonegap-plugin-multidex": "^1.0.0",
    "phonegap-plugin-push": "^2.2.3"
  },
  "devDependencies": {
    "cordova-plugin-whitelist": "^1.3.3"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "phonegap-plugin-push": {
        "ANDROID_SUPPORT_V13_VERSION": "27.+",
        "FCM_VERSION": "11.6.2"
      }
    },
    "platforms": [
      "android"
    ]
  1. Added the google-services.json file to the root directory of my project.
  2. Updated config.xml to copy google-services.json to the Android platform.

Here is a part of my config.xml file with the update to copy google-services.json to the platform:

<platform name="android">
    <resource-file src="google-services.json" target="app/google-services.json" />
    <allow-intent href="market:*" />
</platform>
  1. Running the build.
    
    $ cordova build android --release

... BUILD SUCCESSFUL in 7s 45 actionable tasks: 26 executed, 19 up-to-date Built the following apk(s): /androidTest/platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk


## Environment
```bash
$  cordova info
cordova-lib@9.0.1 with:
  cordova-common@3.2.0
  cordova-create@2.0.0
  cordova-fetch@2.0.1
  cordova-serve@3.0.0

Environment:
  OS: darwin
  Node: v12.4.0
  npm: 6.9.0

$ ./platforms/android/gradlew -v

------------------------------------------------------------
Gradle 4.10.3
------------------------------------------------------------

Build time:   2018-12-05 00:50:54 UTC
Revision:     e76905e3a1034e6f724566aeb985621347ff43bc

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_212 (Oracle Corporation 25.212-b10)
OS:           Mac OS X 10.14.5 x86_64
maxhsantos commented 5 years ago

its possible to use ionic-plugin-firebase and phonegap-plugin-push in the same project? To me this erro show when i try use both.