Reputation: 3
UPDATE: When I delete app storage, it starts to work. I don´t understand...
When I generate a signed APK for my project and I install it to my phone, app crashes. When I debug the app, it works correctly.
I use Android Studio 3 and I disabled instant run.
Using logcat, I get the following exception:
2019-01-15 19:19:30.594 7317-7317/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: me.agomezgz.bng.programa, PID: 7317
java.lang.RuntimeException: Unable to start activity ComponentInfo{me.agomezgz.bng.programa/me.agomezgz.bng.programa.SplashActivity}: android.database.sqlite.SQLiteException: no such table: comentario (code 1 SQLITE_ERROR):
Upvotes: 0
Views: 332
Reputation: 152817
UPDATE: When I delete app storage, it starts to work. I don´t understand...
You had an earlier version of the database file around that did not have that table. Clearing app storage removed the database file and forced sqlite helper onCreate()
to run again.
See When is SQLiteOpenHelper onCreate() / onUpgrade() run?
Why it worked in debug is that the debug package is another application id and has a separate private directory where the database files are stored. That database file did not have this problem.
Upvotes: 0
Reputation: 1017
change your database onCreate method to this :
db.execSQL("CREATE TABLE IF NOT EXISTS comentario(_id integer,
nome text not null,
correo text not null,
texto text not null,
idLoc integer not null, primary key (_id));");
Upvotes: 0
Reputation: 76639
it complains about no such table: comentario
...which means that table comentario
had not been previously created - and that the stack-trace is just a follow-up error. see the build output for the ProGuard warnings (or even add them to the question); there might something obfuscated, which should not have been obfuscated. the code of the database class is completely irrelevant (simply because it works, while not being obfuscated); only the build-log matters. adding -verbose
into the ProGuard configuration might help to obtain some more details.
Upvotes: 1