Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

FAQ Android

mschoch edited this page May 15, 2012 · 14 revisions

Q: What are all these different sub-projects for?

A: TouchDB is designed to be modular, allowing the application developer to choose the pieces they need and distribute the smallest application possible.

  • TouchDB-Android - This is the core of TouchDB. It is required for all TouchDB applications.
  • TouchDB-Android-Ektorp - This is an adapter that allows you to use the Ektorp API to talk to TouchDB. This is the recommended way for building a native Android application. MOST native applications will use this module.
  • TouchDB-Android-JavaScript - This is a module which allows for compilation/execution of view map/reduce functions written in the JavaScript language. Native applications typically do not require this module as they will implement map/reduce functions in Java. This module enables CouchApp/TouchApp style applications which depend on JavaScript. Use of this module adds approximately 1MB to your application.
  • TouchDB-Android-Listener - This module allows you to start an HTTP server port connected to TouchDB. Native applications typically don't need this module unless they also wish to support peer-to-peer replication. The module is also useful for CouchApp/TouchApp style applications, and for running the original CouchDB test suite.
  • TouchDB-Android-TestApp - This module contains the unit tests and a test application which starts the listener on port 8888 and waits for requests.

Q: Why do I see this message when I build TouchDB-Android The method ... of type ... must override or implement a supertype method

A: Typically this happens when you're not using a 1.6 compiler. Check your Java Compiler settings in Eclipse and choose a 1.6 compiler.

Q: Why do I see these messages when I run my application [2012-05-15 15:27:32 - TouchDB-Android] Could not find TouchDB-Android.apk!

A: I'm not sure how to get rid of these, suggestions are welcome.

Q: Why do I see this message when I run my application java.lang.NoSuchMethodError: android.database.sqlite.SQLiteDatabase.insertWithOnConflict

A: This happens when you run with an SDK < 2.2. TouchDB-Android requires SDK 2.2 or newer.

Q: Why do I see a message like java.net.MalformedURLException: Unknown protocol: touchdb

A: When using the Ektorp adapter we need to install a URL handler for the touchdb protocol. This needs to be done early in your application life-cycle prior to using TouchDB or accessing any other URLs. Currently I recommend you place the following static initialization block in your application's main Activity:

{
    TDURLStreamHandlerFactory.registerSelfIgnoreError();
}

Q: Why do I see messages like Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (Acme.Serve.Main$1) that doesn't come with an associated EnclosingMethod attribute.

A: This has to do with the packaging of the HTTP Server library we're using in the Listener module. I think we can fix this by repackaging it properly in the future. For now it does not seem to cause any other problems and can be ignored.