Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failed with Exception, error: cannot find symbol #871

Closed
cormalenv opened this issue Oct 25, 2020 · 14 comments · Fixed by #883
Closed

Build Failed with Exception, error: cannot find symbol #871

cormalenv opened this issue Oct 25, 2020 · 14 comments · Fixed by #883

Comments

@cormalenv
Copy link

As per title build failing with exception after upgrading to 3.0.1. Flutter clean, invalidate caches, sync with gradle all to no avail. Any ideas?

Console output as follows.

C:\...\pub.dartlang.org\flutter_local_notifications-3.0.1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1165: error: cannot find symbol
            notificationManagerCompat.createNotificationChannelGroup(notificationChannelGroup);
                                     ^
  symbol:   method createNotificationChannelGroup(NotificationChannelGroup)
  location: variable notificationManagerCompat of type NotificationManagerCompat
C:\...\pub.dartlang.org\flutter_local_notifications-3.0.1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1173: error: cannot find symbol
        notificationManagerCompat.deleteNotificationChannelGroup(groupId);
                                 ^
  symbol:   method deleteNotificationChannelGroup(String)
  location: variable notificationManagerCompat of type NotificationManagerCompat
C:\...\pub.dartlang.org\flutter_local_notifications-3.0.1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1187: error: cannot find symbol
        notificationManagerCompat.deleteNotificationChannel(channelId);
                                 ^
  symbol:   method deleteNotificationChannel(String)
  location: variable notificationManagerCompat of type NotificationManagerCompat
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_local_notifications:compileDebugJavaWithJavac'.

Flutter Doctor

√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18362.1139], locale en-AU)
    • Flutter version 1.22.2 at D:\...\flutter
    • Framework revision 84f3d28555 (9 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at d:\peeps\android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
@MaikuB
Copy link
Owner

MaikuB commented Oct 25, 2020

Afraid not. This looks like the sort of error that should fail for everyone but worked fine whilst I was testing and passed CI as well. Do you have the same issue if you clone the repo and run the example app?

@MaikuB
Copy link
Owner

MaikuB commented Oct 25, 2020

I doubt it'll help but this the output of when I run flutter doctor -v

[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale en-AU)
    • Flutter version 1.22.2 at /Users/michaelbui/flutter
    • Framework revision 84f3d28555 (9 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/michaelbui/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.1

As I can't reproduce this locally with the apps I've got and it isn't failing CI, I'm thinking it's environmental but if you've already tried cleaning up your pub cache then not sure what other option there is. Might be worth trying to reinstall flutter but not sure if that'll help. I know it's helped others in the past that I'm guessing is to do with a corrupt pub cache

@cormalenv
Copy link
Author

Thanks @MaikuB for the quick response. I noticed you are running on OSX so I dropped the project over to a Mac and it ran fine. I keep everything the same on both machines but for some reason its failing on Windows. I guess something must be out of sync. I'll keep probing and post any results.

@MaikuB
Copy link
Owner

MaikuB commented Oct 25, 2020

Shouldn't matter if it's windows or not though for something like this. In fact, I ran the example app on windows as well and it was working fine

@cormalenv
Copy link
Author

I agree it shouldn't. I was building for iOS though so I'll also test for Android.

In the interim I reinstalled Flutter SDK, updated plugins, ran pub cache repair all to no avail. I started testing different versions. All build fine up to and including 3.0.0+1 but then fails at 3.0.1 when _createNotificationChannelGroup and deleteNotificationChannelGroup methods were added, consistent with error.

@MaikuB
Copy link
Owner

MaikuB commented Oct 25, 2020

As I can't reproduce this then it's not something I can look into. Your best bet is to probably fork the repo and try to compile it to see if and why it shows an error for you to see if it is indeed something that can be fixed

@Gowthamsubramaniam94
Copy link

Gowthamsubramaniam94 commented Oct 30, 2020

Yes as @cormalenv said, build failing with exception after upgrading to 3.0.1.
@MaikuB I'm getting this issue, after Upgrading the plugin to 3.0.1 & flutter SDK to v1.22.2. Now I can't able to downgrade the plugin version to 3.0.0 (But I have added plugin version as flutter_local_notifications: ^3.0.0 in pubspec.yaml).

@cormalenv
Copy link
Author

cormalenv commented Oct 30, 2020

@Gowthamsubramaniam94 remove the caret ^ from the version number ie flutter_local_notifications: 3.0.0 otherwise it looks for the highest version of 3 which is 3.0.1. I couldnt work out a fix and needed to get my app off to Apple so I just set it to only use 3.0.0.

@Gowthamsubramaniam94
Copy link

@cormalenv Thanks. I removed the ^ caret from version number & working with version 3.0.0.

@MaikuB
Copy link
Owner

MaikuB commented Oct 31, 2020

I suspect this has to do with the AndroidX dependencies that your apps are specifying. Have either of you run into the issue with the example app? If you run into the issue then please provide a link to a repo containing a minimal app that reproduces the problem

@MaikuB
Copy link
Owner

MaikuB commented Oct 31, 2020

I believe this should be fixed in 3.0.1+1 now

@cormalenv
Copy link
Author

cormalenv commented Oct 31, 2020

Hmmn, sorry @MaikuB. Same issue as below although only one error now. I'll try to get some time tomorrow to develop minimal code. Thanks.

D:\....\pub.dartlang.org\flutter_local_notifications-3.0.1+1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1189: error: cannot find symbol
        notificationManagerCompat.deleteNotificationChannel(channelId);
                                 ^
  symbol:   method deleteNotificationChannel(String)
  location: variable notificationManagerCompat of type NotificationManagerCompat
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_local_notifications:compileDebugJavaWithJavac'.

@MaikuB
Copy link
Owner

MaikuB commented Oct 31, 2020

Ok looks like I missed that one. Fix to come shortly but yeah a repro sample would be great. I suspect it's to do with the androidx.core dependency as only more recent versions had gotten that channel methods added to NotificationManagerCompat but this was specified in the build.gradle file of the plugin. Perhaps this gets overwritten by what apps are using

@MaikuB
Copy link
Owner

MaikuB commented Oct 31, 2020

This should be fixed now but still be good to get a repro sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants