Testing Android-Couchbase Installation Package

Showing 1-21 of 21 messages
Testing Android-Couchbase Installation Package Marty Schoch 8/25/11 8:27 PM
In our ongoing effort to make it easier for developers to incorporate
Mobile Couchbase into their Android projects, we have a new package
and instructions for developers to test.  If the feedback is positive,
this may replace the other scripts and become the primary installation
method.

Prerequisites:

Android SDK
Eclipse ADT

Instructions:

1.  Create a new Android project or select an existing project.
2.  Download Couchbase.zip and couchbase.xml into the top-level of the project:

https://github.com/downloads/mschoch/Android-Couchbase/Couchbase.zip
https://github.com/downloads/mschoch/Android-Couchbase/couchbase.xml

3.  Right-click on couchbase.xml and select Run As > Ant Build
4.  Refresh your project

You can now add Couchbase to your project using code like:

private final ICouchClient mCallback = new ICouchClient.Stub() {
  @Override
  public void couchStarted(String host, int port) {}

  @Override
  public void installing(int completed, int total) {}

  @Override
  public void exit(String error) {}
};

public void startMyApplication() {
    CouchbaseMobile couch = new CouchbaseMobile(getBaseContext(), mCallback);
    couchServiceConnection = couch.startCouchbase();
}

We think this is the easiest way to get Mobile Couchbase into your
Android project yet.  But we want to hear your feedback!

marty

Re: Testing Android-Couchbase Installation Package Dale Harvey 8/26/11 12:04 PM
Ok I have tested this out and it works great, awesome job

It is by far the easiest way we have had so far,

one small problem I had was that when running the build first time, I actually used the wrong Couchbase.zip which failed the build, that wasnt so much a problem however when I corrected it, it was impossible to run the build again, after a clean build and a refresh (various times) the couchbase.xml still had a red mark with (couchbase.xml not found) this isnt a problem with the script but should probably be in a faq somewhere

Updates I dont think would be a problem, can ant handle wildcard filepaths? I am thinking Couchbase.zip should probably be git sha'd just to keep things obvious, it means couchbase.xml needs to know which version is installed and be able to clean up old files

Cheers
Dale
Re: Testing Android-Couchbase Installation Package Alexander Gabriel 8/26/11 12:46 PM
Sounds great.
But your instructions are not precise or extensive enough for an Android dummy like me.
"You can now add Couchbase to your project using code like:"
What do you mean with "your project"? Would that be the activity.java file?
And how would I manage to get my specific couchapp started?
Thanks for help.
Alex




2011/8/26 Marty Schoch <marty....@gmail.com>

Re: Testing Android-Couchbase Installation Package Marty Schoch 8/26/11 12:48 PM
Yeah I've seen the persistent red mark show up because we include a
file at run-time and have references to tasks that eclipse doesn't
know about.  Even the standard Android ant build files have this
problem.

Certainly we can do a better job of error reporting when the zip file
didn't contain what we expected.

I'm not opposed to adding the sha to the filename, but I was hoping to
keep the couchbase.xml generic enough that on upgrade the user only
has to replace the zip file.  Chris had even thrown out the idea that
the script could (when asked) check the web to see if there was a
newer zip package available.  We might be able to roll all this
together.

marty

Re: Testing Android-Couchbase Installation Package Marty Schoch 8/26/11 12:56 PM
I agree, the instructions for that step are not very clear and make a
lot of assumptions.  I'll see if I can make that more clear in the
next version.

Getting a particular couchapp started may go beyond the basic getting
started instructions though, as you'll most likely have other
decisions to make, such as whether you'll be using Ektorp or not.  But
yes, there should be a document describing how to do this.

marty

Re: Testing Android-Couchbase Installation Package Alexander Gabriel 8/26/11 1:03 PM
looking forward to those instructions. Ektorp is new to me.
Thanks for the great work
Re: Testing Android-Couchbase Installation Package J Chris Anderson 8/26/11 1:04 PM
For what it's worth, we've just upgraded the iOS page to be more
specific about how to get start with iOS. Expect this sort of thing to
show up for Android in the next few weeks.

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

Chris

Re: Testing Android-Couchbase Installation Package Alexander Gabriel 8/26/11 1:08 PM
great, so I'll try that first
Thanks!
Alex



2011/8/26 J Chris Anderson <jch...@couchbase.com>

Re: Testing Android-Couchbase Installation Package Dale Harvey 8/26/11 1:29 PM
Chris are those the right instructions? I only see " (See CouchbaseEmbeddedServer.h, and see EmptyAppDelegate.m for an example of how to call it.)"

Alexander, yeh this will be fleshed out but you had the right idea, its just that code added to the activity, here is the ultra minimal example

http://pastebin.me/45120524e85f5981a813eef6ec12fe7b
Re: Testing Android-Couchbase Installation Package J. Chris Anderson 8/29/11 5:21 PM
Thanks Dale I've updated them. Next up is the Android page...

Chris
Re: Testing Android-Couchbase Installation Package groovinfingers 8/30/11 7:29 AM
Hola, folks.  My company is evaluating this product. The iOS version worked out of the box. The Android experience has been very frustrating.

** System being used **

Mac OS X version 10.6.8. Eclipse 3.6.1.


** Steps to reproduce problem **

08-29 08:44:00.777: ERROR/AndroidRuntime(21797): Caused by: java.lang.UnsatisfiedLinkError: Library com_google_ase_Exec not found

  • I then posted the information above to the URL below at which time a helpful person directed me to this GGroup.

https://github.com/couchbase/Android-Couchbase/issues/1

  • Next, I downloaded the zip and xml file specified earlier in this discussion and added them to my Android project.  I also removed from my Android project all references to the LibCouch project.  
  • After doing this, the couchbase.xml file contains an error.  The error says the following.  

Target couchbase-internal.update-libaries does not exist in this project couchbase.xml /CouchApp line 9 Ant Buildfile Problem


Would someone mind pointing me in the right direction, please?

Thanks for reading this far.

gf


Re: Testing Android-Couchbase Installation Package Marty Schoch 8/30/11 7:58 AM
Hi gf,

We'll definitely help get you up and running.

Although highly confusing, it's actually normal to see the message


"Target couchbase-internal.update-libaries does not exist in this
project        " if you open the couchbase.xml file.  This has to do with us
referencing a target that is included at runtime and not visible to
eclipse.  However, if you right click on that file and select Run As >
Ant Build it should run successfully.

Can you give that a try?

marty

Re: Testing Android-Couchbase Installation Package groovinfingers 8/31/11 7:28 AM
Thanks, Marty.  I appreciate you offering to help.

Yep - I initially had attempted to run the ant script; I apologize for not posting the results.  Here are the results.

Buildfile: /Users/[omitted]/Development/workspace/CouchApp/couchbase.xml

BUILD FAILED

/Users/[omitted]/Development/workspace/CouchApp/couchbase.xml:3: Problem: failed to create task or type include

Cause: The name is undefined.

Action: Check the spelling.

Action: Check that any custom tasks/types have been declared.

Action: Check that any <presetdef>/<macrodef> declarations have taken place.

Total time: 46 milliseconds


gf


Re: Testing Android-Couchbase Installation Package Marty Schoch 8/31/11 7:51 AM
That error message helps a lot.  It cannot find the task "include".
According to the docs this was introduced in ant 1.8, so it looks like
you may have an earlier version of ant.  You should be able to check
this by running:

ant -version

That said, we have an updated version of the zip/script package that I
hope will be posted today.  One of the changes in this script is we
changed from using "include" to "import".  Hopefully your version of
ant understands the import task (though we may find other issues, I
have not tested with anything less than 1.8)

Once the files are online we'll post a message to this group.  Your
assistance in testing these scripts will be a big help to the
community.

Also, it would be great if you could let us know your Eclipse version
as well as your Ant version.  We'll at least want to document which
versions we know work.

Thanks,
marty

Re: Testing Android-Couchbase Installation Package Marty Schoch 8/31/11 8:19 AM
I just tested the upcoming package with Eclipse 3.6 which include Ant
1.7.1 and I ran into additional problems.  If you want to get up and
running quickly, I would recommend Eclipse 3.7 which includes Ant
1.8.2.

I'll take a look at how much effort there is in supporting Ant 1.7.x.

marty

Re: Testing Android-Couchbase Installation Package mikeymckay 8/31/11 12:44 PM
I'm with Alexander on this one.

I've been trying to develop a couchdb based app for a few months now,
and it has been a real moving target.

Should I assume that using Dale's "CouchApp" in the market is no
longer recommended?

I have a working application, implemented as a couchapp - so
everything is html, js and REST calls to a couch. One of the main
reasons I am using CouchDB is to avoid the complexity of writing/
maintaining/collaborating on a java app. Now I need to deploy it to
many devices.

I see two ways to get what I need:

1) Install couchapp so that it runs on start and in the background
(recommendations?). Replicate from a couchdb into the android couch to
install my couchapp. Create a bookmark to the local app.
2) Use phonegap to package a couchdb library and my app.

I have been working steadily towards option 1, but am now worried
(freaked out) that it is going to disappear. If we have to use option
2, it would certainly save us massive amounts of headache if we could
just run "couchapp phonegap" and it would package everything up and
compile it into an APK. Is that asking too much?

@mikeymckay

On Aug 26, 3:46 pm, Alexander Gabriel <a...@barbalex.ch> wrote:
> Sounds great.
> But your instructions are not precise or extensive enough for an Android
> dummy like me.
> "You can now add Couchbase to your project using code like:"
> What do you mean with "your project"? Would that be the activity.java file?
> And how would I manage to get my specific couchapp started?
> Thanks for help.
> Alex
>
> 2011/8/26 Marty Schoch <marty.sch...@gmail.com>
Re: Testing Android-Couchbase Installation Package Dale Harvey 8/31/11 1:03 PM
Hey Mike

The "CouchApp" app on the market has been renamed to "MobileFuton", it will be available in the market indefinitely

https://market.android.com/details?id=com.daleharvey.mobilefuton

Your option of building an application against this one is exactly why I built it, however I built it as a development tool for android apps and not a deployment one.

For the final deployment of applications, its recommended you follow these instructions to build a standalone application that includes the code to your couchapp, that way your uses dont need to do any bookmarking or replication, and you dont need to worry about my app dissapearing (or more likely being updated in incompatible ways)

Recently the android toolchain has undergone a quite a few changes, however this is all in the aim of reducing the complexity of building a standalone app as much as possible, we are now at the point where things should start settling down and we can completely flesh out the documentation and make things as clear as possible

Cheers
Dale

P.S it should be eventually possible to have a single "couchappdeploy MyApp.apk", and some of the work being done here will allow that to happen, however for the time being I will update my MobileFuton app which can be used to deploy any couchapp on to android, I will email the list when thats done.
Re: Testing Android-Couchbase Installation Package Mike McKay 8/31/11 1:56 PM
Thanks Dale,

For the final deployment of applications, its recommended you follow these instructions to build a standalone application that includes the code to your couchapp, that way your uses dont need to do any bookmarking or replication, and you dont need to worry about my app dissapearing (or more likely being updated in incompatible ways)

Looking at the instructions and the sample EmptyApp (https://github.com/couchbase/Android-EmptyApp) it is not clear to me what interface couchbase is providing and how one might configure it. Specifically, once I have run:

couch.startCouchbase()

How do I communicate with it? Is it on localhost at port 5984? If I package an html file (a la Phonegap) will I be able to pull resources from CouchDB or will that be cross domain (cross port anyway)? Instead of packaging an html file, can I just replicate my couchapp into it and open a URL that points to a design document? 

public void postInstall() { //I am totally making this code up CouchbaseMobile couch = new CouchbaseMobile(getBaseContext(), mCallback); couch.replicate("http://mikeymckay.iriscouch.com/egra", "egra"); } public void startCouchbase() { CouchbaseMobile couch = new CouchbaseMobile(getBaseContext(), mCallback); couchServiceConnection = couch.startCouchbase(); // Wouldn't this be great? Browser.loadURL("http://localhost:5984/egra/_design/app/index.html") }
That would be awesome. But it could be even better. Imagine a web page. You go there, point it to a couchapp URL out in the cloud "http://mikeymckay.iriscouch.com/egra/_design/app/index.html". After clicking a magic button that says "Create android app" it returns an Android APK file ready to deploy anywhere. I can dream, can't I?

Anyway, I now have mobilefuton and it looks like it has come a long way - good work. Keep it up guys!

Mike
Re: Testing Android-Couchbase Installation Package groovinfingers 9/1/11 11:05 AM
Marty - again, thanks.

To answer your question, my version of Eclipse (3.6.1) ships with Ant 1.7.1.  It looks like your tests exposed some problems - possibly the same that I encountered.  Nonetheless, I wanted to make sure I answered your question.  

I'd personally love to switch over to Eclipse 3.7 but from a development-organization point-of-view, I would need to migrate a team of developers over to the new version which means that this effort would need to be coordinated so that our project timelines can remain unaffected.  
It would be ideal if we could remain on Eclipse 3.6 but I am not opposed to making the pitch that we should consider an upgrade to 3.7.  From probably a naive point of view, I personally think there is value in supporting Eclipse 3.6 as doing so will make it easier for shops that are using this version to more easily use the Couchbase product.  An easy installation of a product is always a welcomed treat to a busy developer. heh heh  

I actually have Ant 1.8.2 installed on my Mac and it's in my system path.  As a work-around, could I open up bash and nav to the root of my project folder and then issue the command to run the script?  What I don't know is if the script needs to be issued from the context of Eclipse.

gf

Re: Testing Android-Couchbase Installation Package groovinfingers 9/1/11 11:10 AM
Forgot to say that yes - I'd be happy to offer my time with testing the new version.

gf

Re: Testing Android-Couchbase Installation Package Marty Schoch 9/1/11 2:24 PM
We've updated the Android package to support using Ant 1.7.x and I've
tested it with Eclipse 3.6.1.

As Chris said in his announcement, the latest packages and
instructions can be found here:

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

Thanks again to everyone testing these packages.

marty

More topics »