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

ERROR on (Android) Hive.init() command => HiveError: This should not happen. Please open an issue on GitHub #810

Closed
TheMettaCode opened this issue Oct 14, 2021 · 2 comments
Labels
problem An unconfirmed bug.

Comments

@TheMettaCode
Copy link

Steps to Reproduce
The App hangs during app splash page but when I close the app and clear the data from the app info screen. The app will then open with no issues and work for several cycles (over multiple days) before hanging once again.

Please let me know if you need anything further and thanks for any help you can give. Cheers.

---- Getting the following error upon Hive.init() command

E/flutter (29354): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub.
E/flutter (29354): #0 BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
E/flutter (29354): #1 FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
E/flutter (29354): #2 FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
E/flutter (29354):
E/flutter (29354): #3 StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
E/flutter (29354):
E/flutter (29354): #4 HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
E/flutter (29354):
E/flutter (29354): #5 HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
E/flutter (29354):
E/flutter (29354): #6 main (package:us_congress_vote_tracker/main.dart:54)
E/flutter (29354):
E/flutter (29354):
E/flutter (29354): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub.
E/flutter (29354): #0 BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
E/flutter (29354): #1 FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
E/flutter (29354): #2 FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
E/flutter (29354):
E/flutter (29354): #3 StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
E/flutter (29354):
E/flutter (29354): #4 HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
E/flutter (29354):
E/flutter (29354): #5 HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
E/flutter (29354):
E/flutter (29354): #6 main (package:us_congress_vote_tracker/main.dart:54)
E/flutter (29354):
E/flutter (29354):

Code sample
Code is called in main() as shown below:

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Directory directory = await getApplicationDocumentsDirectory();
Hive.init(directory.path); // <= ** Error seems to occur here **
await Hive.openBox(appDatabase);
await Functions.initializeBox(appDatabase);
if (!kIsWeb) await MobileAds.instance.initialize();
runApp(MyApp());

// Register to receive BackgroundFetch events after app is terminated.
// Requires {stopOnTerminate: false, enableHeadless: true}
if (!kIsWeb)
BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask);
}

Version

  • Platform: Android ** Web version seems to work fine so far **
  • Flutter version: Flutter 2.5.2 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 3595343e20 (13 days ago) • 2021-09-30 12:58:18 -0700
    Engine • revision 6ac856380f
    Tools • Dart 2.14.3
  • Hive version: 2.0.4
@TheMettaCode TheMettaCode added the problem An unconfirmed bug. label Oct 14, 2021
@TheMettaCode
Copy link
Author

After reading some of the other similar issues, I changed the command to 'await Hive.initFlutter()' but had no luck. Still having the issue. It seems to be having trouble creating the initial database but after the install and 'clear app data' it seems to work.

@themisir
Copy link
Contributor

Closed with #914.

Please upgrade to hive v2.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem An unconfirmed bug.
Projects
None yet
Development

No branches or pull requests

2 participants