question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: cannot find symbol import android.app.NotificationChannel;

See original GitHub issue

Error at build time

Your Environment

  • Plugin version: 0.9.0-beta.1
  • Platform: Android
  • OS version: Android
  • Device manufacturer / model: AVD and LeEco 2
  • Cordova version (cordova -v): 7.0.1, 7.1.1
  • Cordova platform version (cordova platform ls): Android 4.4, 5.0, 6.1

Steps to Reproduce

  1. cordova create hello
  2. cd hello
  3. cordova platform add android
  4. cordova run android OK
  5. cordova plugin add cordova-plugin-splashscreen
  6. cordova run android OK
  7. cordova plugin add cordova-plugin-local-notification
  8. cordova run android ERROR

Debug logs

`ANDROID_HOME=H:\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
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_cx9qy3b4evn7wp86k28qfcrpr.run(H:\Git\hello\platforms\android\build.gradle:139) The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0. Incremental java compilation is an incubating feature. The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead. :preBuild UP-TO-DATE :preDebugBuild UP-TO-DATE :checkDebugManifest :preReleaseBuild UP-TO-DATE :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugNdk UP-TO-DATE :CordovaLib:compileLint UP-TO-DATE :CordovaLib:copyDebugLint UP-TO-DATE :CordovaLib:mergeDebugShaders UP-TO-DATE :CordovaLib:compileDebugShaders UP-TO-DATE :CordovaLib:generateDebugAssets UP-TO-DATE :CordovaLib:mergeDebugAssets UP-TO-DATE :CordovaLib:mergeDebugProguardFiles UP-TO-DATE :CordovaLib:packageDebugRenderscript UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:processDebugResources UP-TO-DATE :CordovaLib:generateDebugSources UP-TO-DATE :CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE :CordovaLib:processDebugJavaRes UP-TO-DATE :CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE :CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE :CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE :CordovaLib:bundleDebug UP-TO-DATE :CordovaLib:preReleaseBuild UP-TO-DATE :CordovaLib:checkReleaseManifest :CordovaLib:prepareReleaseDependencies :CordovaLib:compileReleaseAidl UP-TO-DATE :CordovaLib:compileReleaseNdk UP-TO-DATE :CordovaLib:copyReleaseLint UP-TO-DATE :CordovaLib:mergeReleaseShaders UP-TO-DATE :CordovaLib:compileReleaseShaders UP-TO-DATE :CordovaLib:generateReleaseAssets UP-TO-DATE :CordovaLib:mergeReleaseAssets UP-TO-DATE :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE :CordovaLib:packageReleaseRenderscript UP-TO-DATE :CordovaLib:compileReleaseRenderscript UP-TO-DATE :CordovaLib:generateReleaseResValues UP-TO-DATE :CordovaLib:generateReleaseResources UP-TO-DATE :CordovaLib:packageReleaseResources UP-TO-DATE :CordovaLib:processReleaseManifest UP-TO-DATE :CordovaLib:generateReleaseBuildConfig UP-TO-DATE :CordovaLib:processReleaseResources UP-TO-DATE :CordovaLib:generateReleaseSources UP-TO-DATE :CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE :CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE :CordovaLib:processReleaseJavaRes UP-TO-DATE :CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE :CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE :CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE :CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE :CordovaLib:bundleRelease UP-TO-DATE :prepareAndroidArchLifecycleRuntime100Library UP-TO-DATE :prepareComAndroidSupportSupportCompat2610Library UP-TO-DATE :prepareComAndroidSupportSupportCoreUi2610Library UP-TO-DATE :prepareComAndroidSupportSupportCoreUtils2610Library UP-TO-DATE :prepareComAndroidSupportSupportFragment2610Library UP-TO-DATE :prepareComAndroidSupportSupportMediaCompat2610Library UP-TO-DATE :prepareComAndroidSupportSupportV42610Library UP-TO-DATE :prepareMeLeolinShortcutBadger1119Library UP-TO-DATE :prepareOrgApacheCordovaCordovaLib623DebugLibrary UP-TO-DATE :prepareDebugDependencies :compileDebugAidl UP-TO-DATE :compileDebugRenderscript UP-TO-DATE :generateDebugBuildConfig UP-TO-DATE :generateDebugResValues UP-TO-DATE :generateDebugResources UP-TO-DATE :mergeDebugResources UP-TO-DATE :processDebugManifest UP-TO-DATE :processDebugResources UP-TO-DATE :generateDebugSources UP-TO-DATE :incrementalDebugJavaCompilationSafeguard UP-TO-DATE :compileDebugJavaWithJavac :compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:24: error: cannot find symbol import android.app.NotificationChannel; ^ symbol: class NotificationChannel location: package android.app H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:41: error: cannot find symbol import static android.os.Build.VERSION_CODES.O; ^ symbol: static O location: class H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:109: error: cannot find symbol if (SDK_INT < O) ^ symbol: variable O location: class Manager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:112: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: class NotificationChannel location: class Manager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:112: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: method getNotificationChannel(String) location: variable mgr of type NotificationManager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:117: error: cannot find symbol channel = new NotificationChannel( ^ symbol: class NotificationChannel location: class Manager Note: H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\localnotification\TriggerReceiver.java uses or overrides a deprecated API. :compileDebugJavaWithJavac FAILED Note: Recompile with -Xlint:deprecation for details. 6 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘: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.

BUILD FAILED

Total time: 2.694 secs Error: cmd: Command failed with exit code 1 Error output: H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:24: error: cannot find symbol import android.app.NotificationChannel; ^ symbol: class NotificationChannel location: package android.app H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:41: error: cannot find symbol import static android.os.Build.VERSION_CODES.O; ^ symbol: static O location: class H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:109: error: cannot find symbol if (SDK_INT < O) ^ symbol: variable O location: class Manager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:112: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: class NotificationChannel location: class Manager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:112: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: method getNotificationChannel(String) location: variable mgr of type NotificationManager H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\notification\Manager.java:117: error: cannot find symbol channel = new NotificationChannel( ^ symbol: class NotificationChannel location: class Manager Note: H:\Git\hello\platforms\android\src\de\appplant\cordova\plugin\localnotification\TriggerReceiver.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 6 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘: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.`

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
alemdgcommented, May 29, 2018

tired of ionic

8reactions
katzercommented, Jan 6, 2018

Closing since its a duplication. You need the lastest SDK to compile the plugin code even your runtime SDK is lower.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android studio Cannot resolve symbol 'NotificationChannel'
Other classes like NotificationManager are imported just fine. But it's not finding NotificationChannel anywhere. import android.app.
Read more >
NotificationChannel | Android Developers
Returns whether the user has decided that this channel does not represent a conversation. The value will always be false for channels that...
Read more >
Android Notifications - Processing for Android
NotificationChannel ; import android.app. ... it will give you a bunch of errors in the PDE (“The import android.support.v4 cannot be ...
Read more >
[Local Notifications Plugin] Error compiling plugin (Android)
/tmp/build/source/platforms/android/src/de/appplant/cordova/plugin/notification/Notification.java:28: error: cannot find symbol import android.app.
Read more >
React-native-push-notification can not build in android
... error: cannot find symbol import android.app.NotificationChannel; ^ symbol: class NotificationChannel location: package android.app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found