Open HanHuynh91 opened 11 months ago
Same problem here, how did you solve it?
Hello @joaosodres and @joaosodres, follow the solution below:
Go to android/app/src/main/java and in your MainActivity.kt or MainApplication.java on method onCreate and add the import and code below
For Kotlin:
// The import must be use on the top togheter others imports
import android.database.CursorWindow
try {
val field = CursorWindow::class.java.getDeclaredField("sCursorWindowSize")
field.isAccessible = true
field.set(null, 100 * 1024 * 1024) //the 100MB is the new size
} catch (e: Exception) {
if (DEBUG_MODE) {
e.printStackTrace()
}
}
example
For Java:
// The import must be use on the top togheter others imports
import android.database.CursorWindow;
import java.lang.reflect.Field;
try {
Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
field.setAccessible(true);
field.set(null, 100 * 1024 * 1024); // 100MB is the new size
} catch (Exception e) {
if (BuildConfig.DEBUG) {
e.printStackTrace();
}
}
example
Would highly encourage anyone to contribute these snippets by @henrypadua to the official docs under Android troubleshooting
Unfortunately I've already done that and it didn't work
If you're using Expo - following config plugin helped me increase CursorWindow size - link
I took inspiration from following sources:
Don't forget to add plugin to your app.config.ts
plugins: [
["./plugins/withAndroidMainActivity"],
]
and run npx expo prebuild
Hollo @henrypadua, Thank you very much my friend, your solution worked very well, it fixed the bug in production, God bless you, success
Query Select throw error Error: Row too big to fit into CursorWindow requiredPos=4, totalRows=5 in watermelondb in react native app