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: When I build TouchDB-Android I get an error like The method ... of type ... must override or implement a supertype method. How do I fix this?

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: When I run my application I see messages like [2012-05-15 15:27:32 - TouchDB-Android] Could not find TouchDB-Android.apk!. What are these about?

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

Q: When I run my application I see messages like java.lang.NoSuchMethodError: android.database.sqlite.SQLiteDatabase.insertWithOnConflict. How do I fix this?

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

Q: When I run my application I see a message like java.net.MalformedURLException: Unknown protocol: touchdb. What did I miss?

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();
}