I recently experienced a driver issue and while troubleshooting it I wiped my computer and reset my development environment, however I now get the following errors after trying to build my app on android.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:389: error: cannot find symbol
.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
^
symbol: variable POST_NOTIFICATIONS
location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebasePermissionManager.java:63: error: cannot find symbol
permissions.add(Manifest.permission.POST_NOTIFICATIONS);
^
symbol: variable POST_NOTIFICATIONS
location: class permission
After seeing this error I reverted back to a previous working branch via git and still got the same error, then i removed the firebase messaging plugin from my pubspec.yaml file and all the code that goes along with it, there after I got the following error message leading me to think its an issue with my environment.
I re-setup my environment in the following manner (windows)
- setup git
- downloaded android studio and the cli tools
- downloaded vscode and enabled flutter and dart plugins
- downloaded the flutter zip file and extracted it to C:src
- added flutter to environment variables
- downloaded jdk 17
- added JAVA_HOME to both system and user variables
My flutter doctor:
PS C:\Users\cianr> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.22631.2861], locale en-ZA)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
✗ Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 1 category.
PS C:\Users\cianr>
Any help with this issue would be greatly appreciated!
Note: Recompile with -Xlint:deprecation for details.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:56: error: cannot find symbol
case Manifest.permission.BODY_SENSORS_BACKGROUND:
^
symbol: variable BODY_SENSORS_BACKGROUND
location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:85: error: cannot find symbol
case Manifest.permission.POST_NOTIFICATIONS:
^
symbol: variable POST_NOTIFICATIONS
location: class permission
How can i fix this?
Perhaps when you modified your setup, you also altered the Android version used for compilation, leading to changes in the process of permissions. Take a look at this Stack Overflow question, it might provide some useful insights : Can not find Symbol Manifest.permission.WRITE_EXTERNAL_STORAGE on v23