GithubHelp home page GithubHelp logo

amitshekhariitbhu / android-debug-database Goto Github PK

View Code? Open in Web Editor NEW
8.3K 180.0 871.0 1.6 MB

A library for debugging android databases and shared preferences - Make Debugging Great Again

Home Page: https://amitshekhar.me

License: Apache License 2.0

Java 74.00% JavaScript 22.04% CSS 0.53% HTML 3.43%
android-debug-database sharedpreferences database android database-values debug debugging awesome sqlite emulator

android-debug-database's Introduction

About me

Hi, I am Amit Shekhar, I have taught and mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems, and created many open-source libraries being used by top companies. I am passionate about sharing knowledge through open-source, blogs, and videos.

Learn from my blogs: amitshekhar.me/blog

Learn from my videos: youtube.com/@amitshekhar

Get High Paying Tech Job: amitshekhar.me

You can connect with me on:

android-debug-database's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-debug-database's Issues

gradle version is too high.

This is a very practical projects, but I think the gradle compiled version is too high, lead to low version of the project can't compatible.

So if it can in low version?

If there is a subdirectory in /data/data/myapp/databases, than it doesn't work

It just throw an exception like this :

E/SQLiteLog: (14) cannot open file at line 30058 of [9491ba7d73]
E/SQLiteLog: (14) os_unix.c:30058: (21) open(/data/data/myapp/databases/cc) -
E/SQLiteConnection: DB info: sqlite3_open_v2, path: /data/data/myapp/databases/cc, flag: 6, ret: 14
E/SQLiteConnection: DB info: errno = 21, errno message = Is a directory
E/SQLiteDatabase: Failed to open database '/data/data/myapp/databases/cc'.

Although I can open the web, it only show databases's name, you can't see the data.
It seems the lib deals with dir as a database, and cause everything broken after.

No data shown on the panel and Exception

I have a problem with showing the data of the emulator.

I was following those steps:

  • i added the dependency
  • i made this: adb forward tcp:8080 tcp:8080 in my terminal
  • after that i was able to see the panel at: http://localhost:8080

But when i go to this address it shows just nothing, but a blank panel with no data:
debug-database

I also get this Exception:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.rawQuery(java.lang.String, java.lang.String[])' on a null object reference 07-30 00:31:54.978 16077-16159/com.okset.realmsample W/System.err: at com.amitshekhar.utils.DatabaseHelper.getTableData(DatabaseHelper.java:83) 07-30 00:31:54.979 16077-16159/com.okset.realmsample W/System.err: at com.amitshekhar.server.RequestHandler.executeQueryAndGetResponse(RequestHandler.java:235) 07-30 00:31:54.979 16077-16159/com.okset.realmsample W/System.err: at com.amitshekhar.server.RequestHandler.handle(RequestHandler.java:118) 07-30 00:31:54.979 16077-16159/com.okset.realmsample W/System.err: at com.amitshekhar.server.ClientServer.run(ClientServer.java:78)

Why i cannot see any database?

Database Version

It would be great to have a feature to check the database version (PRAGMA user_version), which could be used in migrations.

Export .db file

Awesome library for unrooted device!

Can we actually export the .db file to somewhere?

Relayout navigation to breadcrumbs UX pattern

Hi Amit,

What you think about changing navigation to breadcrumbs UX pattern (something like [Home] -> [Database] -> [Table] in the top of the screen with popups for database or table selection)?

breadcrumbs

So it gives more spacing for content of tables with more than several columns (my case :) )

How can I contribute to this repository?

Hi, I am Devendra, a Java Developer and Android Enthusiast, I have used this library in one of my android projects and its great. I want to be part of development. Let me know, how can I do it?

NullPointerException

      java.lang.NullPointerException: Attempt to get length of null array
      at com.amitshekhar.server.ClientServer.getDBList(ClientServer.java:412)
      at com.amitshekhar.server.ClientServer.handle(ClientServer.java:216)
       at com.amitshekhar.server.ClientServer.run(ClientServer.java:128)
      at java.lang.Thread.run(Thread.java:818)

Order by with query not working

Hi ,

When I use order by clause it is not showing desired result ,But correct data is shown after UI table column sorting.

db

db2

Thank you for useful library

Realm support?

Great work on the library!
I was wondering if this library has Realm support? Since, Realm browser app ( where you can see realm database ) is available only on Mac, it would be great to have Realm support for this library.

Cheers

Integer overflow?

Large INTEGER columns seem to overflow, showing negative number instead of the real value

sqlite> .schema user
CREATE TABLE USER (
id INTEGER PRIMARY KEY AUTOINCREMENT,
createdAt INTEGER NOT NULL,
  ...

Pulling the .db manually and querying

sqlite> select createdAt from user where id=112;
createdAt
1480519860000

DebugDB shows that same cell with value -1243857120

App crashes when I try to load provided URL

Hi,

Saw your post on Medium and thought I would try this out but I am not having much luck. When the app starts up I see the URL but when i try to open, the app crashes and the following error is displayed:

E/AndroidRuntime: FATAL EXCEPTION: Thread-49637 Process: <app.id>, PID: 8713 java.lang.NullPointerException: Attempt to get length of null array at com.amitshekhar.server.ClientServer.getDBList(ClientServer.java:412) at com.amitshekhar.server.ClientServer.handle(ClientServer.java:216) at com.amitshekhar.server.ClientServer.run(ClientServer.java:128) at java.lang.Thread.run(Thread.java:818) E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare() E/AbstractTracker: mTrackerAsyncQueryHandler is null

Do you know what the error issue might be. Not sure if its related but I am using DBFlow ORM.

It seems can not load any data?

I think this project is great, so I write a test app to see it's feature.
I'm sure my phone and my computer are in the same WIFI.
When open the browser, just like this, it has a welcome button, can't see my DB, what's wrong?
image

It always open a html which is in my project

There is a html in my project,and then it always go to the html when i try to open the address that printed in the console. I try to change the port,but it does't worked.I am confused.

Library not working if table name is a reserved keyword.

Made a table with name "transaction" in my app, and library crashes when i request that table.

Stack trace:

03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile E/SQLiteLog: (1) near "transaction": syntax error
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err: android.database.sqlite.SQLiteException: near "transaction": syntax error (code 1): , while compiling: SELECT * FROM transaction
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at com.amitshekhar.utils.DatabaseHelper.getTableData(DatabaseHelper.java:80)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at com.amitshekhar.server.RequestHandler.getAllDataFromTheTableResponse(RequestHandler.java:197)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at com.amitshekhar.server.RequestHandler.handle(RequestHandler.java:102)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at com.amitshekhar.server.ClientServer.run(ClientServer.java:75)
03-29 10:01:47.594 30095-30114/in.shipsy.riderapp.firstmile W/System.err:     at java.lang.Thread.run(Thread.java:841)

I'd like to fix this bug. Thanks.

Pragma doesn't work

Hi,

If I try to execute query like PRAGMA table_info(myTable); I'll get error.
Root cause is in DatabaseHelper class in method executeQueryAndGetResponse.
It checks if first word in query is "select" and does query otherwise does execSql which doesn't support results.

I think this could be solved by checking for "pragma" as well and in that case executing "getTableInfo" method.

can't query having '%' string

may be fix javscript code

$.ajax({url: "query?query="+escape(query), success: function(result){

       result = JSON.parse(result);
       inflateData(result);

}});

Edit and Delete rows have errors

i cannot delete a row.. it shows deleted successfully but when i click again on the table name it shows the deleted row.. when i edited a column value whole table got updated to the new row(redundant rows). help me with this.

[Feature request] Files management

Hey,

great tool! I treat it as a central place to get data from the app during my development. Although it would be nice to have files management as well. Files stored in the application's files directory could be:

  • viewable
  • deletable
  • uploadable

What do you think about it? Do you have any plans? Is this kind of contribution possibly welcome?

display encrypted data

I try to use it, but shows the encrypted data.
GCmsAMnORmFEE75OR97CBy5Yx3sVp/GEXKuHxneFKdJhT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8z7qmQ8vMfJjawaN0kpzOI0aXj2IYd4q4JLKk1t8yVfLJ25D9jEcBcuA==

ip adress issues

some times receive the Ip is 192.168.199.240, This will not open the database. My local Ip is 192.168.2.xx.

http://0.0.0.0:8080 is shown for real phone

When I use my smart phone as AP and let my laptop connect to it, the link will be http://0.0.0.0:8080 and it cannot show anything.

The simplest solution I found is change the URL to router's ip address, for example, http://192.168.1.1:8080, and then it will work. Can you make the address show in the logcat?

java.lang.NullPointerException: Attempt to get length of null array

java.lang.NullPointerException: Attempt to get length of null array
  at com.amitshekhar.server.ClientServer.getDBList(ClientServer.java:412)
  at com.amitshekhar.server.ClientServer.handle(ClientServer.java:216)
  at com.amitshekhar.server.ClientServer.run(ClientServer.java:128)
  at java.lang.Thread.run(Thread.java:818)

The culprit seems to be the following line.

mDatabaseDir.list() is returning null because

If this abstract pathname does not denote a directory, then this method returns null.

https://docs.oracle.com/javase/7/docs/api/java/io/File.html#list()

Although unlikely to happen (if you're choosing to use this library, you probably already have the database ready), it would be nicer if it could handle the edge-case accordingly.

How can i use this in my project, which is not a Android studio project?

Hi, guys! Please help!
For me, my project is not AS(Android Studio) project and is not complied by gradle. It's an android source code project complied with Android.mk. And I don't have right to update the project to android studio project.
I cloned the code and complied it, now I have debug-db-debug.arr and debug-db-release.aar. I can add aar file into Android.mk as static lib, but what should I do in my java code?
What should I import and how to init DebugDB? port ?

App crash when I open url in browser

I added dependency debugCompile 'com.amitshekhar.android:debug-db:0.4.0' and run android app it's running well. but when I open http://192.168.1.19:8080/ in browser app crash with below log.
192.168.1.19 is device ip.
Device: Moto G Turbo running on Android 6.0.1

FATAL EXCEPTION: Thread-21799
Process: com.xxxxx, PID: 5228
java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileDescriptor.setInt$(int)' on a null object reference
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:93)
at java.net.ServerSocket.implAccept(ServerSocket.java:217)
at java.net.ServerSocket.accept(ServerSocket.java:141)
at com.amitshekhar.server.ClientServer.run(ClientServer.java:126)
at java.lang.Thread.run(Thread.java:818)

Not Working on Genymotion

Hi, it is not working on my end. It keeps loading the web page. It is said in the log:

D/DebugDB: Open http://10.0.3.15:8081 in your browser

But it was loading then said that the site can't be reached. Is there anything wrong?
FYI, i use kotlin and there is no java folder inside src. Another info:

  • Min sdk is 15
  • Compile sdk is 25
  • build tools version 25.0.0
  • target sdk 25
  • tested on Genymotion 4.1.1

Please help, thanks!

Can't see custom database location?

It seems you take DBs from com.package.packagename/databases/
My DB location is in com.package.packagename/files/myfolder/mydatabase.db .
So, How can I see for custom database. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.