phonegap / phonegap-plugin-push

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

GCMIntentService.java:139: error: cannot find symbol mBuilder.setColor(iconColor); #51

Closed mwillbanks closed 9 years ago

mwillbanks commented 9 years ago

symbol: method setColor(int) location: variable mBuilder of type Builder

macdonst commented 9 years ago

@mwillbanks What version of Android are you using?

macdonst commented 9 years ago

@mwillbanks are you using the "android-support-v13.jar" that is provided in this project? It contains the proper jar that has the setColor method.

macdonst commented 9 years ago

@mwillbanks I tested on a 4.4.4 device this afternoon with no problems.

hirbod commented 9 years ago

I've the same problem right now. I needed to delete the support-v13 reference cause by "multiple dex" warnings. I can't any way to get this plugin compile.

Dr-Horv commented 9 years ago

Having the same problem. With support-v13 file in platforsm/android/libs I get multiple dexfiles error. If I "android-support-v13.jar" then I get this problem.

hirbod commented 9 years ago

I give up. Struggeled more then 4 days with this problem and I can't get any support on this. As soon as Facebook is integrated (or any other plugin which needs the v13 support, we get this)

v13 support seems to be integrated only because of the "setColor()" method. Now my notifications look ugly, but I've commented out the line to get the build compiled.

mwillbanks commented 9 years ago

@Hirbod you need to remove the support library from the facebook SDK, basically search your codebase for where the items are before you build...

AKA:

find platforms/android -name "android-support*.jar" | grep -v build

If you find duplicates or multiple versions, remove the multiple versions. You can only have 1 support library in your project. The issue becomes is that many plugins attempt to ship one and it causes conflicts between projects. I suggest removing all support libraries that a plugin has and then to manually place one in your libs folder.

hirbod commented 9 years ago

Thank you very much. If I remove the support lib from facebook, I can't compile. The only working solution for me was to remove all support libs from /libs/ inside of platform/android and to leave one support file inside of facebook (I have "CCSoft" Facebook plugin installed, the SDK isn't inside of my platform folder, it's placed in my download folder and got referenced manually inside of eclipse as library).

I can't switch to any other facebook plugin at the moment, but I will try your suggestion, maybe I can find a way.

hirbod commented 9 years ago

I tried your "find" command. No results. :( @mwillbanks

mwillbanks commented 9 years ago

Interesting, your paths might be references differently than provided your earlier comment then; all of mine are inside of the platforms/android folder itself. You would need to add the additional paths in that case.

For instance:

find platforms/android -name "android-support*.jar" | grep -v build
platforms/android/com.phonegap.plugins.facebookconnect/app-FacebookLib/libs/android-support-v13.jar
platforms/android/libs/android-support-v13.jar
hirbod commented 9 years ago

I've removed android-support-v13.jar from the /libs/ folder. Also the v4.jar. I don't use the facebookconnect plugin, my support-v13 lib is inside

/Users/myname/Downloads/facebooksdk/facebook/libs/android-support-v13.jar

I've integrated the facebook-plugin the official way (as described on developers.facebook.com) At the time of choosing this plugin, the official one was very buggy, that was the reason I decided to use a different plugin). If I don't find a way, I will have to switch my facebook plugin to the famous one. Seems like they have fixed the problems.

I'm using this one: https://github.com/huttarichard/cordova-facebook

Before I've installed this plugin, everything worked. I need to find a way to compile both plugin-push and facebook. I need a way to tell the external lib to use the libs inside of cordova, not it's own, but I googled like 10 hours for that problem and I feel desperate :/

hirbod commented 9 years ago

@mwillbanks and @macdonst

I've removed the facebook plugin and also the push plugin, removed android platform, readded android platform and the push plugin, but I get this error message:

/.../platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:139: error: cannot find symbol
            mBuilder.setColor(iconColor);

When I look inside of my /libs/ folder, there is support-v13.jar and support-v4.jar

I've opened the plugin folder, support-v13 and gcm.jar are inside. Inside of plugin.xml I can see:

        <source-file src="src/android/libs/android-support-v13.jar" target-dir="libs/" />

So what's wrong now?

Cordova Android 4.1.0 Android Device: 4.4.2 (Sony Xperia) and 5.1.1 (Samsung Galaxy S6 Edge)

hirbod commented 9 years ago

Hi again, sorry for that spam. For everybody who stuck on this, I've managed to get this work. Go inside of plugins/phonegap-plugin-push/src/android/libs/ and copy android-support-v13.jar

Copy it and replace with the one inside of platforms/android/src

Double-Check that there is NO android-support-v4.jar inside of it. When you find v4, just delete it. Now, the plugin build without problems. If you don't remove v4, it wont work.

I will change my facebook plugin to https://github.com/jeduan/cordova-plugin-facebook4 as this one seems to be a drop-in-replacement and much more active then the official one or the cc-soft one. They also have fixed the multiple DEX problem.

macdonst commented 9 years ago

@Hirbod I'm glad you got it resolved. As soon as PhoneGap Build supports gradle I'm switching this plugin to use the "framework" tag which should avoid these dexing problems for good.

hirbod commented 9 years ago

@macdonst thank you very much. My app is working perfectly right now. Push work's also as expected now. Finally :dancer:

Dr-Horv commented 9 years ago

@macdonst I'm having similiar issue as Hirbod. Although I cannot seem to resolve it by the same steps. I've tried about anything and lost track of what I have and haven't tried. I've concluded that the facebook-connect plugin I'm using https://github.com/uofmmike/phonegap-facebook-plugin clashes with this one on the support-library thing. It seems in either way I remove them respectively plugin doesn't compile. Do you have any tips of step to try resolve this?

Would it be hard to change this plugin to use framework tag? I'm not using phone gap build, rather cordova build. Which as I understand it has gradle support.

macdonst commented 9 years ago

@Dr-Horv yeah, the fix is crazy easy to implement and in fact there is already a PR waiting for when PGB is ready.

https://github.com/keab42/phonegap-plugin-push/commit/472548af8c9235a0bb459bf2bd9b434d6db8eda3

I will try and use the Facebook plugin with this plugin in an app later to see if there is anything I can do in the meantime.

untitledlt commented 9 years ago

@Hirbod did you mean platforms/android/lib/? I tried your suggestion but that does not help.

@macdonst I have tried to replace those lines as in keab42@472548a but that does not help either...

Any other fixes available?

shprink commented 9 years ago

If you are having trouble with Facebook plugin, this fixes it:

cp platforms/android/libs/android-support-v13.jar platforms/android/com.phonegap.plugins.facebookconnect/active-FacebookLib/libs/
rm platforms/android/com.phonegap.plugins.facebookconnect/active-FacebookLib/libs/android-support-v4.jar
000panther commented 9 years ago

Why is everyone embedding JARs in their Plugins? I thought the new way to to it was using

<platform name="android"> <framework src="com.google.android.gms:play-services-gcm:+" /> </platform>

To pull in dependencies via gradle, and avoid all these conflicts?

macdonst commented 9 years ago

@hobbysoldat you are correct. However, PhoneGap Build does not support Gradle yet so I haven't made the switch. I think when I get back off vacation I will switch it and PGB users will have to use version 1.2.2 or earlier.

000panther commented 9 years ago

Good to hear! Sorry for the dupe, thought this would better fit in its own topic.

macdonst commented 9 years ago

@hobbysoldat no problem, I'm just trying to keep all the discussion on this topic in one thread.

alamops commented 9 years ago

@shprink thank you!

ZoRDoK commented 9 years ago

@Hirbod Tnx, you save me out of few hours of headache

kentmw commented 9 years ago

Has anyone experienced this issue while using Phonegap Build to assemble the apk?

hirbod commented 9 years ago

Missing symbols. Add android support and google play library via sdk manager

kentmw commented 9 years ago

@Hirbod, sorry, was that comment directed at my question? Phonegap Build, or PGB, found here: https://build.phonegap.com, builds the application in the "cloud" or at least on adobe's server. I don't have access or control of sdk manager while using PGB

hirbod commented 9 years ago

hi @kentmw - sorry, I mixed something up with email notification. Please ignore my message

adyz commented 9 years ago

I have this issue too. Any solutions that do not imply removing facebook plugin?

000panther commented 9 years ago

Yes. there is a version of the facebook plugin that works with this plugin. just look at this plugins readme page, it has been updated.

phonegap plugin add https://github.com/jeduan/cordova-plugin-facebook4

2015-10-21 14:44 GMT+02:00 Florescu Adrian notifications@github.com:

I have this issue too. Any solutions that do not imply removing facebook plugin?

— Reply to this email directly or view it on GitHub https://github.com/phonegap/phonegap-plugin-push/issues/51#issuecomment-149883607 .

Paul Weber, BSc. Tel: +43(0)699 18 144 914

000panther commented 9 years ago

It uses gradle dependencies instead of hardcoding stuff.

2015-10-21 15:39 GMT+02:00 Paul Weber p4ul.weber@gmail.com:

Yes. there is a version of the facebook plugin that works with this plugin. just look at this plugins readme page, it has been updated.

phonegap plugin add https://github.com/jeduan/cordova-plugin-facebook4

2015-10-21 14:44 GMT+02:00 Florescu Adrian notifications@github.com:

I have this issue too. Any solutions that do not imply removing facebook plugin?

— Reply to this email directly or view it on GitHub https://github.com/phonegap/phonegap-plugin-push/issues/51#issuecomment-149883607 .

Paul Weber, BSc. Tel: +43(0)699 18 144 914

Paul Weber, BSc. Tel: +43(0)699 18 144 914

adyz commented 9 years ago

With facebook4 I get another type of error... :(

adyz commented 9 years ago

This to be more exact:

    FAILURE: Build failed with an exception.

    * What went wrong:
        Execution failed for task ':processArmv7DebugManifest'.
    > Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library /Users/adrian/Desktop/Vivre/Setup-Centos-PuPHPet/cordova-app-push/platforms/android/build/intermediates/exploded-aar/com.facebook.android/facebook-android-sdk/4.7.0/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.facebook" to force usage
hirbod commented 9 years ago

I know this error. You're using Crosswalk @adyz and there is currently a bug.

You need to run like that

> cordova run android -- --minSdkVersion=15

or when you want to release it

> cordova run android --release -- --minSdkVersion=15

Did you see the double -- ? Yes, it has to be EXACTLY like this, or it won't work.

adyz commented 9 years ago

@Hirbod Thanks a ton!!!

I'm new to all this (cordova, android, ios) and it's a bit overwhelming.

000panther commented 9 years ago

or you could add to your config.xml

2015-10-21 16:50 GMT+02:00 Florescu Adrian notifications@github.com:

@Hirbod https://github.com/Hirbod Thanks a ton!!!

I'm new to all this (cordova, android, ios) and it's a bit overwhelming.

— Reply to this email directly or view it on GitHub https://github.com/phonegap/phonegap-plugin-push/issues/51#issuecomment-149920385 .

Paul Weber, BSc. Tel: +43(0)699 18 144 914

hirbod commented 9 years ago

Will not work when crosswalk is installed as it gets overwritten

ndvbd commented 8 years ago

Guys - I see you're talking about the libs folder inside /platforms/android - but I don't have one... How come?

macdonst commented 8 years ago

@nadavb because we no longer need to add jars to this plugin. They've been replaced with frameworks.

bvivek20 commented 8 years ago

Agreed that jars are not added now, but i still get this error GCMIntentService.java:565: error: cannot find symbol

macdonst commented 8 years ago

@bvivek20 update your Android Support Library.

bvivek20 commented 8 years ago

i already did that. new version is 23.1.1

i removed and added android platform again, i still get this error

JerryBels commented 8 years ago

Having the same issue, running latest version of Cordova, all is up to date in the Android SDK manager, and tried to remove and add the platform / the plugin many times...

Note that I also removed the Facebook plugin completely (as well as another one with android-support dependency) then it builds. But whenever I'm adding again any of those 2 plugins (Facebook or the other one) build fails.

:compileDebugJava myprojectpath\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:565: error: cannot find symbol
            mBuilder.setColor(iconColor);
                    ^
  symbol:   method setColor(int)
  location: variable mBuilder of type Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
 FAILED
fredgalvao commented 8 years ago

@JerryBels That's a bug in these other plugins you mentioned, not on phonegap-plugin-push. Report an issue to their authors and request it to be updated to support gradle builds and framework dependencies.

Apee commented 8 years ago

Wow thanks a lot guys the combination of @Hirbod and @hobbysoldat made it work for me ! THANKS!!!!

zabojad commented 8 years ago

I'm experiencing this error but reading at your previous comments, I'm not really sure what I should do. Here is what I have:

platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:571: error: cannot find symbol
            mBuilder.setColor(iconColor);

And:

$ find platforms/android -name "android-support*.jar" | grep -v build
platforms/android/phonegap-facebook-plugin/wink-FacebookLib/libs/android-support-v4.jar
$ cordova plugin list
cordova-plugin-crosswalk-webview 1.5.0 "Crosswalk WebView Engine"
cordova-plugin-whitelist 1.2.0 "Whitelist"
phonegap-facebook-plugin 0.12.0 "Facebook Connect"
phonegap-plugin-push 1.5.2 "PushPlugin"

With latest version of Android support lib installed (23.1.1) and android target freshly removed/re-added.

If I just remove platforms/android/phonegap-facebook-plugin/wink-FacebookLib/libs/android-support-v4.jar, it does not compile neither...

What should be done ?

zabojad commented 8 years ago

Uups, I've posted too fast, the issue actually comes from the facebook plugin and I've managed to fix this issue with this: https://github.com/Wizcorp/phonegap-facebook-plugin/issues/1183

fredgalvao commented 8 years ago

@zabojad or you could follow the suggested steps at https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#co-existing-with-facebook-plugin

lock[bot] commented 6 years ago

This thread has been automatically locked.