Local database not creating on Android 9 arm64-v8a
(1) By anonymous on 2022-09-20 06:58:20 [link] [source]
My app is having a prepopulated Sqlite Database
I am using SqliteAssetHelper to manage the database. It works fine on almost all devices but on some devices with Android-9 and Native Platform arm64-v8a, local database is not getting copied from the asset folder and when the app calls to open the database a NullPointer Exception is thrown.
My DB Helper code is
import android.content.Context;
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
public class DbHelper extends SQLiteAssetHelper {
private static final String DATABASE_NAME = "Calculator.db";
private static final int DATABASE_VERSION = 3;
//Constructor
public DbHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
setForcedUpgrade(3);
}
}
As per the documentation of SqliteAssetHelper the local database gets copied from the asset folder whenever it is called for the first time.
I have gone through this problem, and I think my problem is similar but after digging a lot of links I am not getting any specific answer.
I have also implemented the first call to the database on app open with ASYNC method but it also didn't work.
Stack trace
Caused by java.lang.NullPointerException Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.rawQuery(java.lang.String, java.lang.String[])' on a null object reference
Please Help Me.
(2) By Chris Locke (chrisjlocke1) on 2022-09-20 11:57:01 in reply to 1 [link] [source]
Can't really assist, but I note the database filename starts with a capital C. As filenames are case-sensitive, are you sure this is the correct filename?
(3) By anonymous on 2022-10-08 13:50:25 in reply to 2 [source]
yes, it is working fine on almost all phones, but getting unable to load on some mobile phone with Android 9 and arm64-v8a
(4) By anonymous on 2023-04-26 04:34:32 in reply to 2 [link] [source]
I request you to please assist me with this. Please
(5.1) By Adrian Ho (lexfiend) on 2023-04-26 05:03:04 edited from 5.0 in reply to 4 [link] [source]
Assuming you're the original anonymous poster, this:
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
says you're using a third-party SQLite wrapper, so you're better off asking on whatever support channels are appropriate to SQLiteAssetHelper
.
Thus far, you're doing the equivalent of asking Mercedes-AMG why your Aston Martin V8 Vantage's passenger window is rattling at speed. Just because Mercedes makes the engines used by several car manufacturers, doesn't mean they can service the cars themselves.
If you're not the original anonymous poster, no one can help you until you:
- Start a new thread, instead of hijacking an old one.
- Provide the necessary details.