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

Setup direct code dependencies

Traun Leyden edited this page Jun 26, 2013 · 8 revisions

If you need to debug or hack Couchbase-Lite in the context of the GrocerySync app, these instructions allow you to convert your GrocerySync project to depend on the Couchbase-Lite code directly, rather than depending on Maven artifacts. This will allow you to navigate into Couchbase-Lite code, use breakpoint debugging, and update to the latest source via git pull. These instructions can also to apply to your existing project that is based on Android Studio and currently using Couchbase-Lite Maven artifacts.

  • In the terminal, cd into the directory containing your Android Studio based project

  • cd .. to go to the parent directory of your project.

  • git clone https://github.com/couchbase/couchbase-lite-android.git to get the Couchbase-Lite code in the place expected by CouchChat. Your directory structure should look like this:

.
|-- YourProject
|   |-- YourModule (may have same name as YourProject)
|   |   |-- build.gradle
|   |   |-- libs
|   |   `-- ...
|   |-- README.md
|   |-- build.gradle
|   |-- gradle
|   |-- gradlew
|   `-- settings.gradle
`-- couchbase-lite-android
    |-- CouchbaseLiteProject
    |   |-- CBLite
    |   |-- ...
    `-- README.md
  • cd back into YourProject

  • Edit settings.gradle:

include ':YourProject', ':CBLite', ':CBLiteEktorp'
project(':CBLite').projectDir = new File(settingsDir, '../couchbase-lite-android/CouchbaseLiteProject/CBLite')
project(':CBLiteEktorp').projectDir = new File(settingsDir, '../couchbase-lite-android/CouchbaseLiteProject/CBLiteEktorp')
  • Open the YourProject/YourModule/build.gradle file and change:
dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile fileTree(dir: 'libs', include: 'td_collator_so.jar')  // hack to add .so objects (bit.ly/17pUlJ1)
    compile 'com.couchbase.cblite:CBLite:0.7'
    compile 'com.couchbase.cblite:CBLiteEktorp:0.7.2'
}

to:

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile project(':CBLite')
    compile project(':CBLiteEktorp')
}

(the td_locator.so is not needed since it will already be included by CBLite in this build configuration)

  • Build the code via ./gradlew clean && ./gradlew build

  • Run the project as described in the GrocerySync Readme

  • Follow the steps in the CouchChat README on Enable browsing/debugging Couchbase-Lite source code via Android Studio

Clone this wiki locally