vendredi 1 mai 2015

attempt to write a readonly database, crashes on android 5.0v devices

I'm using SqlCipher for Android my app downloaded from this link. and its working fine on devices with android version upto 4.4v. But app crashing on android 5.0v devices. Following is code snippet

public DBHelperCipher(Context context) {
    super(context, DB_PATH, null, DB_VERSION);
    db = getWritableDatabase("password");// crash occurs at this line
}

Im calling this DbHelperCipher class as shown below

public class ProcessDBCipherInitTask extends AsyncTask <Void, Void, Boolean>{

    private Context ctx;
    public ProcessDBCipherInitTask(Context ctx){
        this.ctx=ctx;
    }

    @Override
    protected Boolean doInBackground(Void... arg0) {
        SQLiteDatabase.loadLibs(ctx);
        dbHelper = new DBHelperCipher(ctx);
        return true;
    }
}

I searched for a solution for it but not able to find a working solution. Someone please help on this.

Thank you.

1 commentaire:

  1. Hi sir,

    I am getting the same error,error code 8: attempt to write a read only database

    When I am write(Insert) record in database at this time I am getting this error in my lolipop device.

    please help me ...

    FYI, I see this issue on Lenovo A7000-a, Lollipop device. Please help on this.

    RépondreSupprimer