Search code examples
androidreact-nativeandroid-gradle-plugincouchbase-lite

Gradle Build error : com.couchbase.lite:couchbase-lite-android:2.1.0


I am trying to install couchbase-lite on react-native android project. When I add dependency of couchbase-lite as explained in here, it gives me the following error.

What I have tried

  1. react-native init MyProject
  2. add dependency implementation 'com.couchbase.lite:couchbase-lite-android:2.1.0' to my ./android/app/build.gradle file
  3. react-native run-andoid

Then found following error

Could not find method implementation() for arguments [com.couchbase.lite:couchbase-lite-android:2.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Does anyone have an explanation or solution for this?


Solution

  • Answering my own question,

    Issue got fixed after upgrading gradle into v4.10 and gradle wrapper plugin into v3.1.0

    ./app/build.gradle

    classpath 'com.android.tools.build:gradle:3.1.0'
    ...
    ext {
    minSdkVersion = 19
    ...
    

    ./app/gradle/wrapper/gradle-wrapper.properties

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
    

    then

    react-native run-android