2

I need to import Couchbase Lite in one of my proyects. I dont want to use Gradle . So basically what I am doing is :

  1. I have donwloaded the proyect from github
  2. I have imported it like a new module (File->New->Impor module->path)

After compilate the proyect I am facing an error,

Cannot resolve symbol AndroidContext

so I need the class

AndroidContext

That class is here so I am trying to import it like the previuse one, like a module, but I am facing this error.

enter image description here

What I am doing wrong? What I should do for import CouchBase lite to android not using

compile 'com.couchbase.lite:couchbase-lite-android:1.4.0'

JoCuTo
  • 2,463
  • 4
  • 28
  • 44
  • I think you should be using couchbase-lite-android for an Android project (which has java-core as its dependency) – borrrden Oct 19 '17 at 21:19
  • and How I can do it ? – JoCuTo Oct 20 '17 at 10:01
  • I suppose start by downloading the [Android project](https://github.com/couchbase/couchbase-lite-android) instead of just java-core? – borrrden Oct 20 '17 at 14:24
  • Tkans, I tried it but I got the same error taht you can see in the screenshot – JoCuTo Oct 20 '17 at 14:44
  • 1
    Hi @JoCuTo, Do you want to integrate CBL source into your Android project? If so, you could refer the following documentation. https://github.com/couchbase/couchbase-lite-android/wiki/Add-Couchbase-Lite-to-your-project-as-a-submodule . – hideki Oct 21 '17 at 00:42
  • @hideki Yes I want to integrate CBL in my code in order to set usePOST variable in ChangeTracker to false. I am still stuck with the solution that you propose, it does not work in my case. I have followed all the steps – JoCuTo Oct 24 '17 at 07:16
  • Error:Failed to resolve: :commons-io-2.0.1: Error:Failed to resolve: :couchbase-lite-android-1.4.0: I get his error in allthe jar – JoCuTo Oct 24 '17 at 09:12
  • @JoCuTo `commons-io-2.0.1` is only used for unit test. You could ignore it if you want. I think your environment might not configure the maven repo with jcenter? https://bintray.com/bintray/jcenter/commons-io%3Acommons-io/2.0.1 – hideki Oct 26 '17 at 05:10
  • thanks @hideki I really apreciate your support but I can not import the librery , I dont know what to do. ¿could you please provide us a complete tutorial about how to import ? https://stackoverflow.com/questions/46929314/empty-folder-importing-external-librery – JoCuTo Oct 26 '17 at 09:12
  • @JoCuTo Please try submodule solution with following the instruction in the link. https://github.com/couchbase/couchbase-lite-android/wiki/Add-Couchbase-Lite-to-your-project-as-a-submodule – hideki Oct 27 '17 at 07:16
  • Now I can import it but If I Build and .apk I get: Error:Execution failed for task ':libraries:couchbase-lite-java-forestdb:buildNative'. > Process 'command 'C:\AndroidSDK\ndk-bundle\ndk-build.cmd'' finished with non-zero exit value 2 I have been reading this issue but aparently the problem is not solved https://github.com/couchbase/couchbase-lite-android/issues/820 – JoCuTo Oct 29 '17 at 12:51
  • If I try again git submodule update --init --recursive I get Failed to clone 'vendor/couchbase-lite-libcrypto' a second time, aborting Failed to recurse into submodule path 'libraries/couchbase-lite-android/libraries/couchbase-lite-java-native/vendor/sqlcipher' Failed to recurse into submodule path 'libraries/couchbase-lite-android/libraries/couchbase-lite-java-native' Failed to recurse into submodule path 'libraries/couchbase-lite-android' – JoCuTo Oct 29 '17 at 12:59
  • Since I have red that libreries are required for tests only I have just removed it from my proyect and it works. – JoCuTo Oct 29 '17 at 13:29

1 Answers1

1

There are a number of other dependencies that you might need:

    implementation 'com.couchbase.lite:couchbase-lite-android:1.4.4'
    // To access the database through HTTP (often used for hybrid development and peer-to-peer sync).
    implementation 'com.couchbase.lite:couchbase-lite-java-listener:1.4.4'
    // To use ForestDB as the storage type.
    compile 'com.couchbase.lite:couchbase-lite-android-forestdb:1.4.4'
    // To enable encryption on SQLite databases.
    compile 'com.couchbase.lite:couchbase-lite-android-sqlcipher:1.4.4'
    // JavaScript view (map/reduce) engine for the REST API.    
    compile 'com.couchbase.lite:couchbase-lite-java-javascript:1.4.4'

Full documentation of gradle includes is here.

Murilo Perrone
  • 452
  • 4
  • 7