Couchbase lite 2.1 android loading pre build database

I have trouble loading a pre build database in couchbase 2.1.
There is sample code given:

DatabaseConfiguration config = new DatabaseConfiguration(getApplicationContext());
ZipUtils.unzip(getAsset("replacedb/"), getApplicationContext().getFilesDir());
File path = new File(getApplicationContext().getFilesDir(), "android-sqlite");
try {
    Database.copy(path, "travel-sample", config);
} catch (CouchbaseLiteException e) {
    Log.e(TAG, "Could not load pre-built database");

But the class ZipUtils can not be resolved. It seems like it does not exist in cb2, it definitely existed in cb1.4.

Futhermore I do not quite undestand what that copy method is for, it was not necessary in cb1.4. And on which file or directory is the path variable pointing?

Many thanks in advance


Can you explain what do you want to do exactly ? I didn’t understand the link between Couchbase and ZipUtils.

What is your goal, your process ?



thanks for your reply,

ZipUtils is a class which was provided by cb1.4 but not anymore by cb2.1. But it is still used in the sample code of 2.1 documentation. Or am I missing something?

My goal it is to load a pre build database which is zipped and bundled in my assets folder.

Ok, it is working now. I manually copied and decompressed the zip file.

Our general policy is to avoid bundling in third party libraries and frameworks (such as ziputils) - because these are not a Couchbase lite dependency.
So as the app developer, you have the option of using any suitable utility library of choice (like zip4j etc).

We will update the docs to clarify as such.