[0.9.0-beta.3] "NotificationCompat does not exist" cause ionic build error
See original GitHub issueWARNING: IF YOU IGNORE THIS TEMPLATE, WE’LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
I am using the “cordova-plugin-local-notification” 0.9.0-beta.2, in an ionic 4 project as per the instruction of native api.
afte the integration , I built the project by command
ionic cordova run android --verbose
the build (after about 40 minutes )failed with the following prompt
...
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:32: error: package android.support.v4.media.app.NotificationCompat does not exist
import android.support.v4.media.app.NotificationCompat.MediaStyle;
^
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:130: error: cannot find symbol
.setChannelId(options.getChannel())
^
symbol: method setChannelId(String)
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:296: error: cannot find symbol
MediaStyle style;
^
symbol: class MediaStyle
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:298: error: cannot find symbol
style = new MediaStyle(builder)
^
symbol: class MediaStyle
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:417: error: constructor Builder in class Builder cannot be applied to given types;
builder = new NotificationCompat.Builder(context, options.getChannel());
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 43m 44s
27 actionable tasks: 1 executed, 26 up-to-date
Command finished with error code 1: /home/wjz/ion/arhat/platforms/android/gradlew cdvBuildDebug,-b,/home/wjz/ion/arhat/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,-Pandroid.useDeprecatedNdk=true
(node:22449) UnhandledPromiseRejectionWarning: Error: /home/wjz/ion/arhat/platforms/android/gradlew: Command failed with exit code 1 Error output:
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:32: error: package android.support.v4.media.app.NotificationCompat does not exist
import android.support.v4.media.app.NotificationCompat.MediaStyle;
^
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:130: error: cannot find symbol
.setChannelId(options.getChannel())
^
symbol: method setChannelId(String)
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:296: error: cannot find symbol
MediaStyle style;
^
symbol: class MediaStyle
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:298: error: cannot find symbol
style = new MediaStyle(builder)
^
symbol: class MediaStyle
location: class Builder
/home/wjz/ion/arhat/platforms/android/app/src/main/java/de/appplant/cordova/plugin/notification/Builder.java:417: error: constructor Builder in class Builder cannot be applied to given types;
builder = new NotificationCompat.Builder(context, options.getChannel());
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 43m 44s
at ChildProcess.whenDone (/home/wjz/ion/arhat/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
(node:22449) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22449) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Your Environment
print-out of “ionic info”
wjz@bj:~/ion/arhat$ ionic info
Ionic:
ionic (Ionic CLI) : 4.3.1 (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.15
@angular-devkit/build-angular : 0.8.6
@angular-devkit/schematics : 0.8.6
@angular/cli : 6.2.6
@ionic/angular-toolkit : 1.0.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-webview 2.0.2, (and 12 other plugins)
System:
Android SDK Tools : 26.1.1 (/home/wjz/Android/Sdk)
NodeJS : v10.7.0 (/home/wjz/.nvm/versions/node/v10.7.0/bin/node)
npm : 6.2.0
OS : Linux 4.15
Environment:
HTTP_PROXY : http://127.0.0.1:37245/
http_proxy : http://127.0.0.1:37245/
HTTPS_PROXY : http://127.0.0.1:37245/
https_proxy : http://127.0.0.1:37245/
Expected Behavior
Tell us what should happen
Actual Behavior
Tell us what happens instead
Steps to Reproduce
Reproduce this issue; include code to reproduce, if relevant
- …
- …
- …
- …
Context
What were you trying to do?
Debug logs
Include iOS / Android logs
- ios XCode logs
- Android: $ adb logcat
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
Ionic 6 Cordova Not Building with cordova-plugin-local ...
When I try to build the project using ionic cordova build android I am getting the below error: > Task :app:compileDebugJavaWithJavac ...
Read more >Ionic Localnotifications With Capacitor: Cannot Find ... - ADocLib
Plugin version: 0.9.0beta.3; Platform: Android; Cordova version cordova v ... build try using the Sync Project with Gradle Files button does not exist....
Read more >android - Ionic LocalNotifications with Capacitor: Cannot find ...
The error occurs in module 'capacitor-cordova-android-plugins'. In the corresponding build.gradle the support library is implemented:.
Read more >Moodle in English: Struggling to build
3. ionic serve command does not show any error, but when the browser opens the app it is just a blank screen with...
Read more >In App Notifications with the Ionic Framework
2 errors FAILED FAILURE: Build failed with an exception. For me, this issue occured when running ionic run android – I don't use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks JapuDCret!
fixes this problem.
Thanks @JapuDCret
This fork fixed the issue