3

I am using SQLite in base feature to delete a table

MyApplication.getDatabase().delete(TABLE_NAME, null, null)

It crashes the application by throwing error:

android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 1546)

Is SQLite supported with Android Instant apps? I was not able to find any documentation on it.

Edit 1:

I am using an emulator with Nexus 5X image running Android 6.0 (API level 23), x86, with Google APIs.

Exact error thrown by SQLite is :

E/SQLiteLog: (1546) os_unix.c:29096: (13) ftruncate(/data/user/0/com.google.android.instantapps.supervisor/files/hosted/com.hello.world.app/databases/Cache.db)

Edit 2:

This code works fine on Pixel API 25

Sunil Kumar
  • 1,631
  • 2
  • 19
  • 33
  • No knowledge of using Android Instant Apps, but: Can you do other operations on the database (i.e. insert values)? From [this SQLite page](https://sqlite.org/rescode.html#ioerr_truncate) the error code seems quite a low-level one: it possibly could be permissions (hence the first question), but _could_ be a low-level or hardware problem (is the database on an SD card?) – TripeHound Aug 07 '17 at 09:48
  • This should be fine. I created a little sample (instant) app to repro, and I was able to delete a table successfully. Can you provide more details? What's the device and Android version? Can you link to sample code? – philo Aug 07 '17 at 16:22
  • Is your database located on external storage, by any chance? You won't be able to access external storage from the Instant App environment. – Troy Aug 09 '17 at 22:07
  • @philo I have edited my answer – Sunil Kumar Aug 26 '17 at 11:25
  • Hmm, nothing obvious from that extra info. Would need more code to repro. Can you fit a repro case into a single Activity and share that? – philo Aug 26 '17 at 15:48
  • I am able to repro this issue on same device with this activity - https://github.com/skstronghold/instant-app-sqlite-crash-repro/blob/master/greet/src/main/java/com/example/hello/myapplication/greet/MainActivity.java . Please check the last commit of this project. I am adding random entries into the table and then deleting them – Sunil Kumar Aug 26 '17 at 17:50
  • @SunilKumar, I hope it has been solved. – Prags Dec 09 '17 at 15:43

0 Answers0