Reputation: 1037
/Users/mycomputer/.pub-cache/hosted/pub.dev/file_picker-8.1.5/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:257: error: cannot find symbol
if (registrar != null) {
^
symbol: variable registrar
location: class FilePickerPlugin
/Users/mycomputer/.pub-cache/hosted/pub.dev/file_picker-8.1.5/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:260: error: cannot find symbol
registrar.addActivityResultListener(this.delegate);
^
symbol: variable registrar
location: class FilePickerPlugin
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':file_picker:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
I'm getting the error with file_picker plugin. I have also deleted the .gradle file but it does not help. I have also changed the file_picker version but it does not help.
Upvotes: 2
Views: 300
Reputation: 10729
The latest update version 8.1.6 (see https://pub.dev/packages/file_picker/changelog#816) to file_picker fixed the issue via https://github.com/miguelpruivo/flutter_file_picker/pull/1644
The PR essentially removes a code section leftover for v1 embedding support. The ticket https://github.com/miguelpruivo/flutter_file_picker/issues/1643 had a ton of duplicates (people don't check if it's already reported), and some PR errornously re-introduced imports for the v1 code section to sooth the compiler, instead of yanking them out. V1 embedding is gone for a good while now.
Temporary fix until this new version was to use the PR's branch:
file_picker:
git:
url: https://github.com/abdelaziz-mahdy/flutter_file_picker
ref: fix-flutter-3.27-compile-error
(with or without a dependency_overrides
, taste differs)
Apparently those v1 embedding codes were removed but another PR accidentally merged only remnants of the v1 embedding code back. The issue should be fixed now (unless there is another regression).
Upvotes: 1
Reputation: 41
The publisher:miguelruivo.com just updated the file_picker pub package.
Download the latest version of file_picker.
file_picker: ^8.1.6
installing via running
flutter pub get file_picker
will automatically download the latest
Upvotes: 2
Reputation: 11
I have the same issue, updating file_picker version does not change anything, even with flutter clean && flutter pub get
.
Upvotes: 0
Reputation: 1
I was facing the same issue.
Go to pubspec.yaml
and change file picker to exact this version :
file_picker: 8.1.4
Upvotes: 0