Cannot retrieve document from couchbase lite when adding documents to couchbase server using admin UI

I am trying to add documents to couchbase server(admin UI) and then trying to retrieve it using couchbase Lite via sync gateway but unable to do so. What I am trying to achieve is I already have a lot of data in couchbase server now I want my mobile app to use it and because that data was not added using sync gateway I want to achieve something like I added data using web now I want my couchbase lite to connect to that couchbase server and retrieve data. Is there any way to do it? or only data that has been added using sync gateway can be retrieved?

EDIT 1 Added Source Codes

Below is the android app code

package com.couchbase.examples.couchbaseevents;

import android.os.Bundle;

import android.util.Log;

import com.couchbase.lite.CouchbaseLiteException;
import com.couchbase.lite.Database;
import com.couchbase.lite.Document;
import com.couchbase.lite.Manager;
import com.couchbase.lite.replicator.Replication;

import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    public static final String DB_NAME = "couchbaseevents";
    final String TAG = "CouchbaseEvents";
    Database database = null;
    protected void onCreate(Bundle savedInstanceState) {
	Log.d(TAG, "Begin Couchbase Events App");
	Manager manager = null;
	try {
	    manager = new Manager(new AndroidContext(this), Manager.DEFAULT_OPTIONS);
	    database = manager.getDatabase(DB_NAME);
	} catch (Exception e) {
	    Log.d(TAG, "Error getting database", e);
	/*try {
	} catch (Exception e) {
	    Log.e(TAG, "Cannot delete database", e);
	try {
	} catch (CouchbaseLiteException e) {
	Document retrievedDocument = database.getDocument("123");
// display the retrieved document
	Log.d(TAG, "retrievedDocument=" + String.valueOf(retrievedDocument.getProperties()));
	Log.d(TAG, "End Couchbase Events App");
    private URL createSyncURL(boolean isEncrypted){
	URL syncURL = null;
	String host = "";
	String port = "4986";
	String dbName = "sync_gateway";
	try {
	    //syncURL = new URL("   :4986/sync_gateway");
	    syncURL = new URL(host + ":" + port + "/" + dbName);
	} catch (Exception me) {
	return syncURL;
    private void startReplications() throws CouchbaseLiteException {
	Replication pull = database.createPullReplication(this.createSyncURL(false));
	Replication push = database.createPushReplication(this.createSyncURL(false));
	    Log.d(TAG, "MyBad");
	/*if(!push.isRunning()) {
	    Log.d(TAG, "Replication is not running due to " +push.getLastError().getMessage());
	    Log.d(TAG, "Replication is not running due to " +push.getLastError().getCause());
	    Log.d(TAG, "Replication is not running due to " +push.getLastError().getStackTrace());
	    Log.d(TAG, "Replication is not running due to " +push.getLastError().toString());


“123” is the document id of document I created in CouchBase server using admin UI

As you can see I first deleted the database( commented part) to make sure there is no document in database and then ran the above replication code.

Below is the sync gateway config file

    "log":["CRUD+", "REST+", "Changes+", "Attach+"],
    "databases": {
	"sync_gateway": {
	        function (doc) {
	        channel (doc.channels);
	    "users": {
	        "GUEST": {
	            "disabled": false,
	            "admin_channels": ["*"]

I also want to ask is there any UI or command line to access CBL. I am currently using CBL in android studio so I dont know how to access its UI or command line

Just for the information, I am able to push data from CBL to CouchBase server

We don’t recommend doing this. Use Sync Gateway’s REST API to add documents to the database. If you must add documents using Couchbase Server APIs, you’ll need to use the bucket shadowing feature. What you’ll really be doing then is writing to a separate bucket, which Sync Gateway then monitors and copies changes into its own bucket.

Is bucket shadowing still supported or not? I read here that support for bucket shadowing has been discontinued by CouchBase

It’s still supported. The statement in that SO thread is incorrect; it must’ve been miscommunicated to our support engineers. Sorry about that.