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

Unhandled Exception: Domain: 2, Code: 30, Message: Read-only file system #19

Open
edityomurti opened this issue Jul 14, 2021 · 4 comments

Comments

@edityomurti
Copy link

I tried to run the example app on Android.
After adding the prebuilt v0.4.0 Android shared libraries and it succeeded to run, I got the following exception.

Do I need to add something? Is it AndroidManifest write permission?

E/flutter (32305): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Domain: 2, Code: 30, Message: Read-only file system
E/flutter (32305): #0      validateError (package:couchbase_lite_dart/src/database_error.dart:25:5)
E/flutter (32305): #1      Database.open (package:couchbase_lite_dart/src/database.dart:138:5)
E/flutter (32305): #2      new Database (package:couchbase_lite_dart/src/database.dart:45:7)
E/flutter (32305): #3      main (package:couchbase_lite_dart_example/main.dart:14:12)
E/flutter (32305): #4      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:142:25)
E/flutter (32305): #5      _rootRun (dart:async/zone.dart:1354:13)
E/flutter (32305): #6      _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter (32305): #7      _runZoned (dart:async/zone.dart:1789:10)
E/flutter (32305): #8      runZonedGuarded (dart:async/zone.dart:1777:12)
E/flutter (32305): #9      _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:138:5)
E/flutter (32305): #10     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
E/flutter (32305): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
@Rudiksz
Copy link
Owner

Rudiksz commented Jul 14, 2021

By default the database is created in the same folder where the app is run, which on Android is who knows what.
You can use the path provider package to get the path to the documents directory, and pass it to the Database.
I kept directory management out of the library on purpose so applications can set the directory depending on platform and business needs.

For Android something like this should work:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
   initializeCblC();

  var docPath = await getApplicationDocumentsDirectory();

  db = Database('appdb', directory: docPath.path);

  runApp(MyApp());
}```

@Rudiksz
Copy link
Owner

Rudiksz commented Jul 14, 2021

I recommend you use the v0.5.x releases for now.

@edityomurti
Copy link
Author

For Android something like this should work:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
   initializeCblC();

  var docPath = await getApplicationDocumentsDirectory();

  db = Database('appdb', directory: docPath.path);

  runApp(MyApp());
}```

Thanks @Rudiksz, it works.

Any idea what would it take to use this lib on a Flutter Web app ?

@Rudiksz
Copy link
Owner

Rudiksz commented Jul 16, 2021

I'm not aware of any mechanism to translate this library to javascript, considering it's native code.

Unless somebody writes a js version of couchbase lite (like PouchDB) or at least implements the sync gateway protocol for PouchDB, I see no way for couchbase lite making it to the web. And if at Couchbase itself are not interested, I doubt it will ever happen.

And even if there was one, there's still the issue of using it in a Flutter app.

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

No branches or pull requests

2 participants