0

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.

borrrden
  • 33,256
  • 8
  • 74
  • 109
Joe
  • 550
  • 2
  • 11
  • 21
  • Are you using Sync Gateway or are you using CouchDB? They are two separate products that aren't to be used together. – borrrden Apr 11 '16 at 21:35
  • @borrden,Do want me to uninstall Sync GateWay and try. – Joe Apr 12 '16 at 04:08
  • No, that won't solve the problem but knowing which one you are using will affect the answer slightly. – borrrden Apr 12 '16 at 04:18
  • I am bit confused here,Let me tell you my understanding,Please correct me If I am wrong. – Joe Apr 12 '16 at 05:18
  • 1)have installed Couchbase-server I think which is required.2)I have installed Couchbase Sync gateway(I have installed this see sync process). What I want to achieve is add item to grocery list sync it and uninstall app when again I install I want see last added item in list – Joe Apr 12 '16 at 05:30
  • 1
    Couchbase Server and CouchDB are two different products. That's why things are confusing. But I know what is going on. – borrrden Apr 12 '16 at 07:12

1 Answers1

1

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.

borrrden
  • 33,256
  • 8
  • 74
  • 109
  • Ya your right,Now I have given my computer IP address and port 4984 but I am getting Connection timeout exception(At the time of sync). My mobile and my computer are connect to two different network is this reason I am getting connection timeout exception? – Joe Apr 12 '16 at 11:48
  • I can't say why you are getting a connection timeout. Perhaps that port is not open on your firewall, but it sounds like a general connectivity issue between your two machines. – borrrden Apr 12 '16 at 21:32