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.
Please Help Me.