0

I am following the instructions here

http://www.couchbase.org/get/couchbase-mobile-for-android/current

After I start an instance of Couchdb, how do I push a couchapp from my machine to the emulator ?

Neha
  • 77
  • 6
  • Hi. CouchDB speaks HTTP in any case, running on Android as well as on any other OS. Can you reach the server by entereing the IP and port? If so, you should be able to use couchapp http://www.couchapp.org for pushing an app in there. –  Nov 24 '11 at 13:52

1 Answers1

1

I noticed your question is old, but hope this answer is still useful to you. Here's what I did.

First, setup port forwarding to your emulator.

adb forward tcp:5985 tcp:5984

This makes the CouchDB instance running on your Android emulator available on port 5985 of your host machine. Verify it works with:

$ curl localhost:5985

You should get a response with version you have installed on your emulator:

{"couchdb":"Welcome","version":"1.2.0a-7b47329-git"}

If you're using the CouchApp toolchain, you can push the app from your file system to your emulator like this:

couchapp push . http://localhost:5985/my-app

Alternatively, if the app is already installed (pushed) on your server (assuming server is your local host machine) you can issue a replicate command (HTTP POST) that looks similar to this:

$ curl -H 'Content-Type: application/json' -X POST http://localhost:5984/_replicate -d ' {"source": "http://localhost:5984/my-app", "target": "http://localhost:5985/my-app", "create_target": true, "continuous": true} '

That should do the trick. Let me know if you run into any troubles.

chadmaughan
  • 578
  • 1
  • 4
  • 12
  • hey I found this really helpful! I know this is old but i wanted to know how to do the same for the real phone! not just emulator! can we somehow include this process in the application? so we don't need the computer? – Khashayar Apr 26 '12 at 19:30
  • I'm not certain I understand your question. The CouchDB API is HTTP (which is what makes it nice to work with). If you can hit the port that CouchDB is running on you should be able to replicate between two instances. The reason the question was asked is because the emulator makes it a bit difficult as you have to port forward prior to having it react like a regular CouchDB instance. – chadmaughan May 01 '12 at 16:38