amitshekhariitbhu / Android-Debug-Database

A library for debugging android databases and shared preferences - Make Debugging Great Again
https://outcomeschool.com
Apache License 2.0
8.41k stars 869 forks source link

My Database shows empty #105

Closed ananth10 closed 5 years ago

ananth10 commented 6 years ago

I am using room to access my database in my app. but all i can see is empty gitdb

amitshekhariitbhu commented 6 years ago

Click on git.db

ananth10 commented 6 years ago

db-debug

ananth10 commented 6 years ago

I have clicked all. but i could not see anything

irudayambics commented 6 years ago

I am also facing the same issue. Any solution to it?

kazaky commented 6 years ago

Yeah me too, This happens when the records of database are too much Say larger than 1000 record or something

whui-adr commented 6 years ago

Me too, I am running the test app on Android Oreo.

LoveqLRC commented 6 years ago

Same issuse

LoveqLRC commented 6 years ago

when I change compile 'android.arch.persistence.room:runtime:1.1.0-beta1' to compile 'android.arch.persistence.room:runtime:1.1.0-alpha1' the problem is fixed

ubuntudroid commented 6 years ago

The log says

net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
rohsyl commented 6 years ago

@ubuntudroid got the same error. Can't make it work..

bjprogrammer commented 6 years ago

same issue. anyone found solution to this?

daniele-sartiano commented 6 years ago

Same issue.

LeoDroidCoder commented 6 years ago

same

DawidJamrozy commented 6 years ago

I have occured the same error when i upgraded room version from 1.0.0 to 1.1.0. At 1.0.0 everything works just fine, the problem is with version 1.1.0, i haven't checked other versions of room. @amitshekhariitbhu @ananth10

NirajManjhi commented 6 years ago

screen shot 2018-05-15 at 4 07 43 pm

I am also facing the same issue. Two days back it was working for me and today it shows empty database.

LeoDroidCoder commented 6 years ago

As a temporary workaround you ma downgrade Room to 1.0.0

On Tue, May 15, 2018, 13:39 NirajManjhi notifications@github.com wrote:

[image: screen shot 2018-05-15 at 4 07 43 pm] https://user-images.githubusercontent.com/24686649/40051961-327b9e26-585a-11e8-8092-6981c5a472b7.png

I am also facing the same issue. Two days back it was working for me and today it shows empty database.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/amitshekhariitbhu/Android-Debug-Database/issues/105#issuecomment-389122547, or mute the thread https://github.com/notifications/unsubscribe-auth/AYihwqoLNnvV2X3H_N4Yb-yfd7dRFyCkks5tyrB9gaJpZM4SZ223 .

NirajManjhi commented 6 years ago

Working perfect with both the Room versions (1.0.0 and 1.1.0)

I just commented the following lines which contains proguard in build.gradle(Module: app)-->buildTypes and everything started working fine.

I think it was happening because Proguard doesn't allow anyone to see the data inside your app.

buildTypes { debug { debuggable true // minifyEnabled true // shrinkResources true // useProguard true // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }

saiimons commented 6 years ago

Same issue here with room 1.1.0 and same logs as https://github.com/amitshekhariitbhu/Android-Debug-Database/issues/105#issuecomment-383305447

saiimons commented 6 years ago

Found that if the Room DB is built using .setJournalMode(TRUNCATE), it works perfectly.

This means that the write-ahead logging data breaks the library.

DawidJamrozy commented 6 years ago

@saiimons It worth to mention that method .setJournalMode() was added after version 1.0.0 so You'll have to upgrade room version in your gradle file in order to use it.

saiimons commented 6 years ago

@DawidJamrozy As the issue seems to be appearing with 1.1.0, people using 1.0.0 won't have to do this. See : image

@ananth10 @irudayambics @TallShahawi @whui-adr @LoveqLRC @ubuntudroid @bjprogrammer @daniele-sartiano see my previous comment for a solution.

@amitshekhariitbhu you may add a try catch when opening a DB file, with proper error handling, this could prevent the server from crashing.

amitshekhariitbhu commented 6 years ago

@saiimons I will consider your suggestion.

eriknyk commented 6 years ago

I'm using Room v1.1.0 and I'm getting the following error:

Database: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
    net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
        at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
        at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
        at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
        at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
        at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
        at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
        at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1867)
        at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
        at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2486)
        at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
        at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
        at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
        at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1065)
        at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1226)
        at com.amitshekhar.server.RequestHandler.openDatabase(RequestHandler.java:185)
        at com.amitshekhar.server.RequestHandler.getTableListResponse(RequestHandler.java:304)
        at com.amitshekhar.server.RequestHandler.handle(RequestHandler.java:113)
        at com.amitshekhar.server.ClientServer.run(ClientServer.java:76)
        at java.lang.Thread.run(Thread.java:762)
E/ClientServer: Exception.

also I've tried adding:

.setJournalMode(TRUNCATE)

but it not fixed it in my case. Any thought? Regards.

NirajManjhi commented 6 years ago

Again I am facing the same issue. Please resolve it so that our development will be seamless. We are taking help of this library. Please help.

NirajManjhi commented 6 years ago

I was getting the same SqliteException as mentioned above and my database was showing empty. I have done minor config changes and everything working absolutely fine now. Please find the configuration below:

Room Persistence Library implementation 'android.arch.persistence.room:runtime:1.1.1-rc1' annotationProcessor "android.arch.persistence.room:compiler:1.1.1-rc1"

Android-Debug-Database debugImplementation 'com.amitshekhar.android:debug-db:1.0.1' (Changed from 1.0.3 to 1.0.1) as mentioned in official Mindorks blog (https://blog.mindorks.com/debugging-android-databases-and-shared-preferences-in-the-easiest-way-e5f705dfc06b)

build.gradle (Module app) buildTypes { debug { debuggable true } release { debuggable false // minifyEnabled false // useProguard false // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }

MainDatabase.java Room.databaseBuilder(context.getApplicationContext(), MainDatabase.class, AppConstants.DATABASE_NAME) .fallbackToDestructiveMigration() .setJournalMode(TRUNCATE) .build(); screen shot 2018-06-18 at 4 33 17 pm