1

I m using preload database with multiple tables with data. when I run db.rawQuery() method, SqliteException occure ::

android.database.sqlite.SQLiteException: no such table.

This error occurred in on android pie, all previous working very well. Please let me know how to solve this issue.

Rohit5k2
  • 17,948
  • 8
  • 45
  • 57
Hector
  • 11
  • 1
  • How are you creating database and tables ? If you're copying empty db from Assets to private folder then it won't work in Android 9. – M D May 02 '19 at 12:20
  • Try uninstalling your app and installing again – Shrey Garg May 02 '19 at 12:22
  • .sqlite file already preloaded in assets folder and run time this file copied to device data/data/packagename/databases/database.sqlite. This code working on all android previous version, not wokring in android 9.0 pie – Hector May 02 '19 at 12:23
  • Yes i knew that's why i asked. Check [this](https://stackoverflow.com/questions/50476782/android-p-sqlite-no-such-table-error-after-copying-database-from-assets) answer and change your code accordingly. This solution worked in all android versions – M D May 02 '19 at 12:25
  • Already tried uninstalled and re-install. – Hector May 02 '19 at 12:25
  • Tried, but not work if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { SQLiteDatabase database = getReadableDatabase(); Complete_PATH = database.getPath(); database.close(); } else if (android.os.Build.VERSION.SDK_INT >= 4.1) { Complete_PATH = DB_PATH + DB_NAME; } else { Complete_PATH = DB_PATH + DB_NAME; } database = SQLiteDatabase.openDatabase(Complete_PATH, null,SQLiteDatabase.OPEN_READONLY); – Hector May 02 '19 at 13:02

0 Answers0