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

Other Installation Options

James Nocentini edited this page Jan 3, 2017 · 3 revisions

From source

You may prefer to clone this repo and use it in your project instead of using what is published on npm. The steps below describe how to do that.

  1. Create a new React Native project.

    # Update react-native-cli
    npm install -g react-native-cli
    # Create a new project
    react-native init MyApp
    # Start the RN server
    cd MyApp
    react-native start
  2. Install the react-native-couchbase-mobile module relatively to the root of this repo.

    npm install ./../
  3. Link it with your MyApp project.

    rnpm link react-native-couchbase-lite
  4. Follow those steps in the README to add the remaining dependencies for iOS and Android.

Install manually

iOS (react-native init)

$ react-init RNTestProj
$ cd RNTestProj
$ npm install react-native-couchbase-lite --save
  • Drag the ReactCBLite Xcode project in your React Native Xcode project:

  • Add ReactCBLite.a (from Workspace location) to the required Libraries and Frameworks.

  • From the Link Binary With Libraries section in the Build Phases of the top-level project, add the following frameworks in your Xcode project (Couchbase Lite dependencies):

    • libsqlite3.0.tbd
    • libz.tbd
    • Security.framework
    • CFNetwork.framework
    • SystemConfiguration.framework
  • Download the Couchbase Lite iOS SDK from here and drag CouchbaseLite.framework, CouchbaseLiteListener.framework in the Xcode project:

iOS (Cocoapods)

  • Install both npm modules:
$ npm install react-native
$ npm install react-native-couchbase-lite
  • In the Podfile, add dependencies:
pod 'React', :path => './node_modules/react-native'
pod 'ReactNativeCouchbaseLite', :path => './node_modules/react-native-couchbase-lite'
  • Install the Cocoapods dependencies:
$ pod install
  • So far so good! Next, you must install CBLRegisterJSViewCompiler.h and libCBLJSViewCompiler.a. You can download both components from here. Drag CBLRegisterJSViewCompiler.h into the couchbase-lite-ios Pod:

  • Add the libCBLJSViewCompiler.a static library:

Android

  • Add the react-native-couchbase-lite project to your existing React Native project in android/settings.gradle

     ...
     include ':react-native-couchbase-lite'
     project(':react-native-couchbase-lite').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-couchbase-lite/android')
    
  • Add the Couchbase Maven repository to android/build.gradle

     allprojects {
     		repositories {
     				mavenLocal()
     				jcenter()
     
     				// add couchbase url
     				maven {
     						url "http://files.couchbase.com/maven2/"
     				}
     		}
     }
    
  • Add android/app/build.gradle

     apply plugin: 'com.android.application'
     
     android {
     		...
     
     		packagingOptions {
     				exclude 'META-INF/ASL2.0'
     				exclude 'META-INF/LICENSE'
     				exclude 'META-INF/NOTICE'
     		}
     }
     
     dependencies {
     		compile fileTree(dir: 'libs', include: ['*.jar'])
     		compile 'com.android.support:appcompat-v7:23.0.0'
     		compile 'com.facebook.react:react-native:0.12.+'
     
     		// Add this line:
     		compile project(':react-native-couchbase-lite')
     }
    
  • Register the module in getPackages of MainApplication.java

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new ReactCBLiteManager()				<----- Register the module
        );
    }
    

LICENSE

MIT

Clone this wiki locally