Cordova-plugin-local-notifications: Build failed for Android

Created on 14 Jan 2016  Â·  15Comments  Â·  Source: katzer/cordova-plugin-local-notifications

I use Intel XDK and when passing to the new CLI 5.1.1 I got a build error and I can't use anymore your plugin.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
:compileArmv7ReleaseJava.../MyApp/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:130: error: cannot find symbol
.setColor(options.getColor())
^
symbol: method setColor(int)
location: class Builder
.../MyApp/platforms/android/src/de/appplant/cordova/plugin/notification/Options.java:262: error: cannot find symbol
return NotificationCompat.COLOR_DEFAULT;
^
symbol: variable COLOR_DEFAULT
location: class NotificationCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileArmv7ReleaseJava'.

Compilation failed; see the compiler error output for details.

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

BUILD FAILED

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Could you please fix it?

android Awaiting Information

Most helpful comment

I fixed it by installing "Android Support Repository" in the Android SDK Manager

All 15 comments

Running into the same issue with a different fork of the plugin. The issue is the plugin is shipping with an android-support library that is causing conflicts with other plugins.

To solve it and get a build here are the steps I did:

  1. Clean out any generated platform directory (platforms/android)
  2. Comment out this line in the plugin's plugin.xml file:
    <lib-file src="libs/android/android-support-v4.jar" />
  3. Renamed the android-support-v4.jar file in the plugin's libs/android folder to use a .tmp directory (probably not needed, but just to make sure).

Was able to successfully build and everything works.

I fixed it by installing "Android Support Repository" in the Android SDK Manager

Error

I also had the same error. I inspected the *plugins folder and found some issues:

  • src/android was empty (other platforms too)
  • www was empty
  • There wasn't a plugin.xml.

There might have been more issues.

My solution

What I did was deleting the plugins folder from:

  • root/plugins/
  • root/platforms/android/platform_www/plugins/
  • root/platforms/android/src/de/ (I didn't have other plugins from Germany)

After that I ran the command: phonegap run android again and the error was gone.

--UPDATE--

@bradrlaw: I have a build-extras.gradle in root/platforms/android to solve the problem with the android-support library.

build-extras.gradle:

configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }

--UPDATE--


*plugins folder = root/plugins/de.appplant.cordova.plugin.local-notification

Same problem here

Same issue for me :(

me too....

I solved temporaly this issue downgrading the plugin version:

ionic plugin remove de.appplant.cordova.plugin.local-notification
ionic plugin add de.appplant.cordova.plugin.[email protected]

Hope this helps.

Thanks for the hint Rodrix. I tried downgrading step-by-step and found that 0.8.2 works OK.
With 0.8.3 and 0.8.4 I'ḿ getting following errors:

COLOR_DEFAULT cannot be resolved or is not a field Options.java /MainActivity/src/de/appplant
/cordova/plugin/notification line 262 Java Problem
DEFAULT_LIGHTS cannot be resolved or is not a field Options.java /MainActivity/src/de/appplant/cordova/plugin/notification line 245 Java Problem
The method setColor(int) is undefined for the type NotificationCompat.Builder Builder.java /MainActivity/src/de/appplant/cordova/plugin/notification line 130 Java Problem

Found it: I was using an outdated version of android-support-v4.jar in my Java build path. Replaced it by the latest version. No build errors anymore!

How I replace the android-support-v4.jar? please help

I had the same problem today,

I am using facebook plugin and I tried to install "cordova-plugin-local-notifications". There is a conflict between those 2 plugin because facebook plugin uses the old version of android-support-v4.jar ...

After 6 hours fight(I shame of it..) I found solution for my app:

I found every single android-support-v4.jar file in my app (it is about 700kb) and changed it with new version. The new version is in android-sdk\extrasandroid\support\v4

I hope it will help for next victims..

(sorrry because of my bad english)

+1

@nickkenens Did you try my solution?

I solved this issue removing file:
/platforms/android/libs/android-support-v4.jar

Is this still an issue otherwise I'll close it.

Was this page helpful?
0 / 5 - 0 ratings