How to use this function“Database Replicas” in the lastest couchbase lite 2.0

From this content “Database Replicas
Database replicas is available in the Enterprise Edition only ( Starting in Couchbase Lite 2.0, replication between two local databases is now supported. It allows a Couchbase Lite replicator to store data on secondary storage. It would be especially useful in scenarios where a user’s device is damaged and the data needs to be moved to a different device. Note that the code below won’t compile if you’re running the Community Edition of Couchbase Lite.”,I don’t know how to use this function.

Disclaimer: Enterprise edition features may only be used in production after purchasing an enterprise license.

When you create a ReplicatorConfiguration instead of URLEndpoint use DatabaseEndpoint

thank you very much! i will try it!

your way is ok, do not need an enterprise license. it is free in the android .

What do you mean by free? The replica features require a license (legally, not technically) to be used in production. I imagine you installed the enterprise version of the library right? Check it’s license file.

Couchbase Lite Enterprise Edition

In the top-level build.gradle file, add the following Couchbase Maven repository in the allprojects section.
allprojects {
repositories {
maven {
url “
Next, add the following in the dependencies section of the application’s build.gradle (the one in the app folder).
dependencies {
compile ‘com.couchbase.lite:couchbase-lite-android-ee:2.0.0’

that is need a license.

public static void copyDataBase()
DatabaseConfiguration config0 = new DatabaseConfiguration(mcontext);
File folder = new File(String.format("%s/SmartKitchen", Environment.getExternalStorageDirectory()));
Database dbTarget=null;
try {
dbTarget = new Database(“copyDB”, config0);
} catch (CouchbaseLiteException e) {
MyLog.e(“Database Init”+e.toString());
DatabaseEndpoint databaseEndpoint = new DatabaseEndpoint(dbTarget);
ReplicatorConfiguration config1 = new ReplicatorConfiguration(SrcDb, databaseEndpoint)
Replicator replicator1 = new Replicator(config1);
my code will create a copyDB from srcDB

Like I said, it is not a technical barrier but a legal one. A license cannot stop you from installing from maven central or JCenter or another maven feed as you have done (at least I don’t know of any way). However the fact that you have chosen “couchbase-lite-android-ee” instead of “couchbase-lite-android” means you have downloaded the Enterprise Edition, which is not free to use in production.

You can refer to this blog post which describes how Couchbase Server classifies its products. Mobile has now adopted the same with its 2.0 release. See the section “What is Enterprise Edition?”

thank you borrrden. i will check this funtion in the 2.0 release .but I don’t feel it’s necessary to charge for this small function.

There will be more and more EE features over time. This is just the first one that made it in. 2.1 will bring P2P replication and encryption, for example.

For others following the thread, here is the summary:

couchbase-lite-android is free to use for development and production
couchbase-lite-android-ee is free for development, but not free for production

The same goes for iOS and .NET

thanks to borrrden, i get it!

Just to re-iterate what @borrrden mentions, the LICENSE.TXT file in the Android package contains our Enterprise Edition License Agreement.