Search code examples
androidcouchbasecouchbase-litecouchbase-sync-gateway

CouchDB Sync not happening in GrocerySync-Android application


I am new to couchDB,As a starting point I downloaded GrocerySync-Android and try to run on device(Samsung Galaxy S4) but data sync is happening.

This is what tried,

1)I have created "grocery-sync" in Data Buckets (couchbase-server)

2)I have changed Sync URL as shown below

public static final String SYNC_URL = "http://127.0.0.1:4984/grocery-sync";

When I change URL as shown above I am getting following Exception.

RemoteRequest io exception.  url: http://127.0.0.1:4984/grocery-sync/_local/022315cfb2e1f188613f04c99e49fbd537341d69
org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:4984 refused

Then I tried changed my URL to:

http://127.0.0.1:5984/grocery-sync

Still I am getting same Connection refused exception.

Then I searched for issue some one suggested to use to following IP 10.0.2.2 so URL become:

 http://10.0.2.2:4984/grocery-sync

If I use above URL I not getting Connection refused exception but I am getting following exception:

RemoteRequest: io exception.  url: http://10.0.2.2:4984/grocery-sync/_local/840159ea2a7e8f5a483f502f5ae79f2ad9f64ddf
org.apache.http.conn.ConnectTimeoutException: Connect to .. timed out

I am not getting what I am missing!!

3)When I start sync_gateway following I can see on console,

**Reset guest user to config
Starting profile server on
Starting admin server on 127.0.0.1:4985
Starting server on localhost:4984..**

After that I wont see any logs.

Please let me what I am missing or doing wrong..Any help or guidance greatly appreciated.


Solution

  • Your sync gateway is not running on "localhost" in terms of your Android device. That would mean that Sync Gateway is running on your device, but it's not. It is running on your computer so you need to use the IP address of your computer and port 4984.