I used a populated .sqlite database in a project. I imported the bd into the assets folder and implemented the code for creating and accessing the database. I ran the project and everything worked ok in the emulator and on the phone directly. The problem is that when I generate the signed apk to send to other people the application does not create the bank. The apk is generated normally and the app is also installed on the device, but in the activity that would have to do the execution and query in the bank happens an error, which I implemented in the code with a toast, accusing that the database could not be created. I can not understand why everything works ok when I compile in the emulator or directly on the phone, but when I install from apk does not work the part of the database.
Would anyone have any idea why this happened ?! Thanks!
Note: I can not see error logs because I'm generating the apk by installing on the device and running. I do not run the run on AndroidStudio, because as I said when the project is run in the emulator or device directly there is no error, however when I install the app from the apk separately on the device, the database does not create. Is there any way to view error logging when the app is installed and run in this separate way from AndroidStudio?
The error that gives the toast message "Copy data error" that charges that the bank was not created is in this snippet of code:
//Check exists database
File database = getApplicationContext().getDatabasePath(DatabaseHelper.DBNAME);
if(false == database.exists()) {
mDBHelper.getReadableDatabase();
//Copy db
if(copyDatabase(this)) {
Toast.makeText(this, "Copy database succes", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Copy data error", Toast.LENGTH_SHORT).show();
return;
}
}