Installing WatermelonDB from github gives "Unable to resolve module @nozbe/watermelondb/adapters/sqlite"

559 views Asked by At

I am trying to compile a hello-world react-native app that has WatermelonDB configured. I am following the instructions given here and and here to set up the project for Watermelon.

I have found that if I install WatermelonDB using

yarn add @nozbe/watermelondb

the application launches correctly in android and iOS. But if I install from github:

yarn add https://github.com/Nozbe/WatermelonDB.git

I get the following error:

Unable to resolve module error

Does anyone know why installing directly from github results in this error when running the application?

1

There are 1 answers

0
Zohaib Naseer On

Add these lines in android/app/build.gradle

android {
defaultConfig {
        ...
        minSdkVersion 21 // add this
        multiDexEnabled true // add this
     }
}

add this in dependencies

implementation 'com.android.support:multidex:1.0.3'

then sync after that

clean the project, build folder, gradlew and idea

cd android
./gradlew clean

also

rm -rf .gradle && rm -rf .idea