Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

[React Native][Android] error: use of undeclared identifier 'assert' #1138

Open kaxline opened 3 years ago

kaxline commented 3 years ago

https://github.com/Nozbe/WatermelonDB/blob/06607aebfdb33ab1a07728e009cb53ceca82dd75/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp#L75

I've just ran into the following build errors using Gradle 7.1.1 and WatermelonDB@0.23.0:

ProjectRoot/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp:71:5: error: use of undeclared identifier 'assert'
      assert(env);
      ^
  ProjectRoot/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp:76:5: error: use of undeclared identifier 'assert'
      assert(jvm);
      ^
  ProjectRoot/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp:81:5: error: use of undeclared identifier 'assert'
      assert(jvm);
      ^
  ProjectRoot/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp:85:5: error: use of undeclared identifier 'assert'
      assert(env);
      ^
  4 errors generated.

And I was able to fix it by adding

#include <cassert>

To the top of /native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp

It's probably related to my local environment, but posting here just in case it helps someone else. Is there any downside to adding that #include statement to the project file? If not it seems like an easy fix ...

diegolmello commented 1 year ago

Fixed on https://github.com/Nozbe/WatermelonDB/pull/1198