phonegap / phonegap-plugin-push

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

Build Issue Android #1460

Closed dezudas closed 7 years ago

dezudas commented 7 years ago

Expected Behaviour

Build/Compilation success

Actual Behaviour

compilation broken for android platform

Reproduce Scenario (including but not limited to)

update the cordova platfrom and plugin to latest and build the app 

Steps to Reproduce

cordova build android -d

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

All

Cordova CLI version and cordova platform version

cordova --version                                    6.4.0
cordova platform version android                     6.1.0

Plugin version

cordova plugin version | grep phonegap-plugin-push  2.0.0-rc1

Sample Push Data Payload

Sample Code that illustrates the problem

cordova build android -d

Logs taken while reproducing problem

Executing script found in config.xml for hook "before_build": scripts/copy_resource_files.js No scripts found for hook "before_prepare". Checking config.xml for saved platforms that haven't been added to the project Checking for any plugins added to the project that have not been installed in android platform No differences found between plugins added to project and installed in android platform. Continuing... Generating platform-specific config.xml from defaults for android at /Users/dijup/mobileapp/chordpedia/platforms/android/res/xml/config.xml Merging project's config.xml into platform-specific android config.xml Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www Wrote out android application name "Chordpedia" to /Users/dijup/mobileapp/chordpedia/platforms/android/res/values/strings.xml Wrote out Android package name "com.dez.chordpedia" to /Users/dijup/mobileapp/chordpedia/platforms/android/src/com/dez/chordpedia/MainActivity.java Updating icons at platforms/android/res Updating splash screens at platforms/android/res Prepared android project successfully Executing script found in hooks directory for hook "after_prepare": hooks/after_prepare/uglify.js Running command: /Users/dijup/mobileapp/chordpedia/hooks/after_prepare/uglify.js /Users/dijup/mobileapp/chordpedia Command finished with error code 0: /Users/dijup/mobileapp/chordpedia/hooks/after_prepare/uglify.js /Users/dijup/mobileapp/chordpedia Checking config.xml for saved plugins that haven't been added to the project No scripts found for hook "before_compile". ANDROID_HOME=/Users/dijup/Development/sdk/ JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home Reading build config file: /Users/dijup/mobileapp/chordpedia/build.json Reading the keystore from: /Users/dijup/mobileapp/chordpedia/chordpedia.keystore Subproject Path: CordovaLib Running command: /Users/dijup/mobileapp/chordpedia/platforms/android/gradlew cdvBuildDebug -b /Users/dijup/mobileapp/chordpedia/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 0.771 secs Command finished with error code 1: /Users/dijup/mobileapp/chordpedia/platforms/android/gradlew cdvBuildDebug,-b,/Users/dijup/mobileapp/chordpedia/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,-Pandroid.useDeprecatedNdk=true Error: /Users/dijup/mobileapp/chordpedia/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

macdonst commented 7 years ago

@dezudas thanks for the bug report. Oddly enough I had a similar problem with the FCM library complaining about the + in the input stream which is why I pinned it to 9.8.0. I'll look at doing the same for com.google.gms.google-services.

macdonst commented 7 years ago

@dezudas can you try installing the latest from master? You'll need to make sure you have the 25.1.0 support library installed.

dezudas commented 7 years ago

@macdonst thank you! issue has been resolved,

phonegap-plugin-push 1.9.2 "PushPlugin"

alonsovb commented 7 years ago

I'm having the exact same problem when trying to build android.

$ cordova --version
6.4.0

$ cordova platform version android
Installed platforms:
  android 6.1.1

$ cordova plugin version | grep phonegap-plugin-push
phonegap-plugin-push 2.0.0-rc2 "PushPlugin"

I get this message after running ionic build android:

BUILD FAILED

Total time: 3 mins 50.947 secs
Error: /Users/alonso/Work/ElArtesanoApp/artesanoapp-develop/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script '/Users/alonso/Work/ElArtesanoApp/artesanoapp-develop/platforms/android/phonegap-plugin-push/elArtesanoApp-push.gradle' line: 12

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

+1, exactly same error message, same versions

Honorato commented 7 years ago

@alonsovb and @kirillgroshkov, I solved it (actually it is a workaround, I didn't figured out how to really solve it) by editing the file platforms/android/project.properties, according to this post http://stackoverflow.com/questions/41408514/com-google-android-gms-common-internal-safe-parcel-safe-parcelable-not-found.

I said it's a workaround because this file is generated every time we add the android platform.

Hope it helps.

amritk commented 7 years ago

Having the same problem on android as well

$ cordova --version 
7.0.0
$ cordova platform version android
Installed platforms:
  android 6.2.3
  ios 4.4.0
$ cordova plugin version | grep phonegap-plugin-push
phonegap-plugin-push 2.0.0-rc3 "PushPlugin"
$ cordova build android --stacktrace
cordova-custom-config: Skipping auto-restore of config file backup(s)
ANDROID_HOME=/Users/amritk/Library/android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
null
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_c3puixypsoru4vva0jcuf0azz.run(/Users/amritk/apps/cordova/platforms/android/build.gradle:140)
org.xwalk:xwalk_core_library:23+

FAILURE: Build failed with an exception.

* Where:
Script '/Users/amritk/apps/cordova/platforms/android/phonegap-plugin-push/hc_app-push.gradle' line: 12

* What went wrong:
A problem occurred evaluating root project 'android'.
> 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: 2.16 secs
Error: /Users/amritk/apps/cordova/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script '/Users/amritk/apps/cordova/platforms/android/phonegap-plugin-push/hc_app-push.gradle' line: 12

* What went wrong:
A problem occurred evaluating root project 'android'.
> 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.

The workaround mentioned above did not work, going to go back to a 1.x version for now

jabit commented 7 years ago

HI, here same problem, I can not get running "cordova-plugin-googleplus 5.1.1" with "phonegap-plugin-push 2.0.0-rc4" together.

I am on Ubuntu 16.04 using cordova 7.0.1 and Android Studio 2.3.3. cordova plugin ls: cordova-plugin-googleplus 5.1.1 "Google SignIn" (I have tried v. 5.1.0 as well with same result) cordova-plugin-whitelist 1.3.2 "Whitelist" phonegap-plugin-push 2.0.0-rc4 "PushPlugin" (same with 1.10.4) cordova -v: 7.0.1

cordova requirements android: Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-26,android-25 Gradle: installed /opt/gradle/gradle-3.5/bin/gradle

cordova run android: ANDROID_HOME=/home/javier/Android/Sdk JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 Subproject Path: CordovaLib 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_2yk4wyvk2jiu3c2ezjbfi0909.run(/home/javier/cordova/sportybetty/platforms/android/build.gradle:139)

FAILURE: Build failed with an exception.

BUILD FAILED

How can I fix that? tnk

macdonst commented 7 years ago

@jabit that problem is being tracked in #1718

lock[bot] commented 6 years ago

This thread has been automatically locked.