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

undefined registrar variable in Java code of file_picker plugin #1647

Open
jacklee1995 opened this issue Dec 14, 2024 · 13 comments
Open

undefined registrar variable in Java code of file_picker plugin #1647

jacklee1995 opened this issue Dec 14, 2024 · 13 comments
Labels
new issue An issue that hasn't yet been seen from the maintainer

Comments

@jacklee1995
Copy link

Describe the bug


AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:257: ����: �Ҳ�������
if (registrar != null) {
^
����: ���� registrar
�: �� FilePickerPlugin
C:\Users\a2911\AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:260: ����: �Ҳ�������
registrar.addActivityResultListener(this.delegate);
^
����: ���� registrar
�: �� FilePickerPlugin
2 ������

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.

  • Try:

Run with --info option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 9s

It seems that this error is caused by the use of undefined registrar variable in Java code of file_picker plugin, which leads to compilation failure.

According to the error message, the problem lies in lines 257 and 260 of the' FilePickerPlugin.java' file. The code tries to access a variable named' registrar', but this variable is not defined.


Android 14,
Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision dec2ee5c1f (4 weeks ago) • 2024-11-13 11:13:06 -0800
Engine • revision a18df97ca5
Tools • Dart 3.5.4 • DevTools 2.37.3

Similar errors occurred in flutter_file_picker 8.1.5 and 8.1.4.

@jacklee1995 jacklee1995 added the new issue An issue that hasn't yet been seen from the maintainer label Dec 14, 2024
@kajalramnanii
Copy link

Facing same issue, any solution?

@jacklee1995
Copy link
Author

Try running flutter clean, and be careful to delete the .lock file in your project first. Then modify the version number, and finally run flutter pub get again.

@jacklee1995
Copy link
Author

In addition, the last working version I tried was 8.13.

@jacklee1995
Copy link
Author

Facing same issue, any solution?

Back to version 8.13, do not use 8.14 or 8.15.

@jacklee1995
Copy link
Author

Describe the bug
AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:257: ����: �Ҳ������� if (registrar != null) { ^ ����: ���� registrar λ��: �� FilePickerPlugin C:\Users\a2911\AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:260: ����: �Ҳ������� registrar.addActivityResultListener(this.delegate); ^ ����: ���� registrar λ��: �� FilePickerPlugin 2 ������
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.

  • Try:

Run with --info option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 9s

It seems that this error is caused by the use of undefined registrar variable in Java code of file_picker plugin, which leads to compilation failure.
According to the error message, the problem lies in lines 257 and 260 of the' FilePickerPlugin.java' file. The code tries to access a variable named' registrar', but this variable is not defined.
Android 14, Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision dec2ee5c1f (4 weeks ago) • 2024-11-13 11:13:06 -0800 Engine • revision a18df97ca5 Tools • Dart 3.5.4 • DevTools 2.37.3
Similar errors occurred in flutter_file_picker 8.1.5 and 8.1.4.

Screenshot 2024-12-14 203819 Screenshot 2024-12-14 203834 Do you know how to downgrade the version ? I can't downgrade even though I changed the version in pubspec.yaml

You need to specify a specific version, don't use "^",in this way, you will not be automatically upgraded to 8.1.5.

@MrCsabaToth
Copy link

Duplicate of #1643

And there's no 8.13 or 8.14 or 8.15. There 8.1.3, 8.1.4, 8.1.5

@omeramasib
Copy link

Same issue happens with me

@rufus-op
Copy link

you can use this repo i have fixed the issue

https://github.com/rufus-op/file_picker

replace

file_picker: 8.1.5

with

file_picker:
git:
url: https://github.com/rufus-op/file_picker

@Jay19-dev
Copy link

First of all,
There's no such version 8.13 or 8.14, it's 8.1.3, 8.1.4 and 8.1.5.

Secondly, the issue is: registrar variable is not defined in FilePickerPlugin.java file (version 8.1.5)
but the same file in version 8.1.4 doesn't have that variable hence it is working perfectly fine (Version 8.1.4)

Therefore, till the issue gets fixed, you can use version 8.1.4.

@MrCsabaToth
Copy link

you can use this repo i have fixed the issue

https://github.com/rufus-op/file_picker

replace

file_picker: 8.1.5

with

file_picker: git: url: https://github.com/rufus-op/file_picker

Bro, you didn't fork the repo but copied it, and simply overwrote stuff??? rufus-op/file_picker@05992a8#diff-c693279643b8cd5d248172d9c22cb7cf4ed163a3c98c8a3f69c2717edd3eacb7R3
What are all the changes?

Everything should be just a few lines like it is in #1644

Guys, don't use that code, use the PR code like so: #1643 (comment)

@TharinduHub
Copy link

First of all, There's no such version 8.13 or 8.14, it's 8.1.3, 8.1.4 and 8.1.5.

Secondly, the issue is: registrar variable is not defined in FilePickerPlugin.java file (version 8.1.5) but the same file in version 8.1.4 doesn't have that variable hence it is working perfectly fine (Version 8.1.4)

Therefore, till the issue gets fixed, you can use version 8.1.4.

this helps!

@ksmohamed
Copy link

same issues

ksmohamed added a commit to ksmohamed/flutter_file_picker that referenced this issue Dec 16, 2024
@husainazkas
Copy link

perhaps duplicate #1643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
Development

No branches or pull requests

9 participants