GithubHelp home page GithubHelp logo

infinum / android_dbinspector Goto Github PK

View Code? Open in Web Editor NEW
944.0 50.0 93.0 18.67 MB

Android library for viewing, editing and sharing in app databases.

License: Apache License 2.0

Kotlin 99.69% Groovy 0.31%
android android-library android-development database database-management db sqlite3 sqlite couchbase couchdb

android_dbinspector's Introduction

Download Validate Gradle Wrapper Code analysis CodeFactor codecov

DbInspector

UI

DbInspector provides a simple way to view the contents of the in-app database for debugging purposes. There is no need to pull the database from a connected device. This library also supports inspecting of the SQLite databases created by CouchBase Lite out of the box. With this library you can:

  • preview all application sandbox databases
  • import single or multiple databases at once
  • search, delete, rename, copy, share a database
  • preview tables, views and triggers
  • preview table or view pragma
  • delete table contents
  • drop view or trigger
  • search table, view or trigger
  • sort table, view or trigger per column
  • execute any valid SQL command in editor per database connection

Getting started

To include DbInspector in your project, you have to add buildscript dependencies in your project level build.gradle or build.gradle.kts:

Groovy

buildscript {
    repositories {
        mavenCentral()
    }
}

KotlinDSL

buildscript {
    repositories {
        mavenCentral()
    }
}

Then add the following dependencies in your app build.gradle or build.gradle.kts :

Groovy

debugImplementation "com.infinum.dbinspector:dbinspector:5.4.9"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.9"

KotlinDSL

debugImplementation("com.infinum.dbinspector:dbinspector:5.4.9")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.9")

Usage

DbInspector can be invoked explicitly or implicitly.

  • explicitly - call DbInspector.show() anywhere and anytime that you see fit, like onClick methods, lambdas or similar.
  • implicitly - when you add the dbinspector package an Activity alias is automatically merged into your application manifest that in return creates a launcher icon for DbInspector, but when you add the dbinspector-no-op the same Activity alias node is automatically removed from your application manifest. Implicit way can be tweaked to achieve desired behaviour as demonstrated in an example below.

Explicit

DbInspector.show()

Implicit If you use dbinspector package but do not want an additional automatic launcher icon merged in and generated.

<!--suppress AndroidDomInspection -->
<activity-alias
    android:name="com.infinum.dbinspector.DbInspectorActivity"
    tools:node="remove" />

If you use DbInspector for a specific flavor and need to override merged in launcher label, you can provide a String resource in your project exactly like this:

<string name="dbinspector_launcher_name">Sample Debug</string>

Please do mind and copy over the suppression comment line too, if you need it. Further modification can be done according to rules of manifest merging and attributes of activity-alias XML node.

Editor

Editor

DbInspector has a build in editor scoped per database connection currently used.
It offers autocomplete of SQLite3 keywords and functions, current table and column names.
Built in editor also provides a history of executed statements, not matter if they were successful or not.
History of statements is persisted between sessions and can be cleared on demand at any point.
Panes between editors' input and result are scalable and can be adjusted by dragging the splitter between them.
Landscape mode is supported too for better result preview of large datasets.

Logging

DbInspector provides a independent and built in logger mechanism. Per default logger is initiated as an EmptyLogger omitting any output whatsoever.
In case logs output is required, AndroidLogger should be used as shown below:

DbInspector.show(logger = AndroidLogger())

Additionally, AndroidLogger uses Level to filter out between info, debug, error or no messages at all.

Requirements

Minimum required API level to use DbInspector is 21 known as Android 5.0, Lollipop. As of 4.0.0 version, AndroidX is required. If you cannot unfortunately migrate your project, keep the previous version until you get the opportunity to migrate to AndroidX. DbInspector is written entirely in Kotlin, but also works with Java only projects and all combinations of both.

License

Copyright 2020 Infinum

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Credits

Maintained and sponsored by Infinum.

android_dbinspector's People

Contributors

aexyn avatar anacar avatar bclymer avatar bojankoma avatar domagojkorman avatar ignaciotcrespo avatar jakoss avatar johngorithm avatar jonatanplesko avatar melcha avatar nicopico-dev avatar orionlee avatar prashamtrivedi avatar reisub avatar rkrsgithub avatar zplesac avatar

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

android_dbinspector's Issues

App crashes when trying to open a Couchbase DB (version 1.2.1)

I tried to use this library to see the content of a Couchbase db.

Whenever I try to open the .cblite2 DB the app crashes with the following exception:

android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:318)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:228)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:206)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:908)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:878)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:699)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:714)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:707)
at im.dino.dbinspector.helpers.CursorOperation.execute(CursorOperation.java:20)
at im.dino.dbinspector.helpers.DatabaseHelper.getAllTables(DatabaseHelper.java:164)
at im.dino.dbinspector.fragments.TableListFragment.onActivityCreated(TableListFragment.java:133)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1983)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
at im.dino.dbinspector.fragments.DatabaseListFragment.onItemClick(DatabaseListFragment.java:45)
at android.widget.AdapterView.performItemClick(AdapterView.java:334)
at android.widget.AbsListView.performItemClick(AbsListView.java:1536)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3683)
at android.widget.AbsListView$3.run(AbsListView.java:5604)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6134)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

Any idea of how to solve it ?

Exclude -wal, etc. from database list

Feature Request: In database list screen, exclude sqlite-internal files, -wal, and -shm, in addition to the already-supported -journal filtering.

No actionbar

Hi
Is there some tweak to make this run without Actionbar?
Thank you

Leaked connections to database.

This is a good tool - will save me copying the database out to the desktop to view..

However it doesnt seem to close properly..

01-04 23:13:11.309    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.309    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.309    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.309    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.309    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.310    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.310    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-04 23:13:11.310    1528-1542/nz.org.winters.android.nzmobileaccountwidget W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/nz.org.winters.android.nzmobileaccountwidget/databases/widgetdata3.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.

Unnecessary Timber plant

✍️ Describe the bug

Here: https://github.com/infinum/android_dbinspector/blob/master/dbinspector/src/main/kotlin/com/infinum/dbinspector/DbInspector.kt#L15-L18
you are using Stump tree on release builds. Is that really necessary? Every time i open DbInspector my logging tree gets bigger with useless tree. Why not just plant debug tree on debug build and else do nothing?

Also - i think you should use some static flag to mark that tree was already planted and not do that again on every inspector open.

And while we're at that - could you make logging optional? I could even do that with simple PR. The reason is quite weird - i have to store logs in local db. I'm using Timber.Tree to do that. And now every time i go in DbInspector i have logs spam about the connection i just made to look at logs table. I would love to just turn that off (or maybe use some TAG for DbInspector, then i could just filter those out

Not showing databases in sdcard

My app makes database in Phone Storage and SD card. It is Showing data of Phone Storage but not of sdcard. Location of my db id sdcard/android/data/<myapp_package_name>/files/<database.db>. Is it not supported or just an issue??

Control over dbinspector shortcut

⚠️ Please describe your feature request

I want to use dbinspector just in the Explicit way for the release version, so I removed the additional launcher icon but the Android shortcut (long click of app icon) still exists. Please provide a way to remove the shortcut like the automatic launcher icon.

💡 Describe the solution you'd like

📊 Describe alternatives you've considered

📄 Additional context

🙋 Do you want to develop this feature yourself?

  • Yes
  • No

Memory leak

I have used Square's LeakCanary and I got this after rotating the screen:

In com.sample.esource:dev:0.
* im.dino.dbinspector.activities.DbInspectorActivity has leaked:
* GC ROOT static android.support.v4.content.LocalBroadcastManager.mInstance
* references android.support.v4.content.LocalBroadcastManager.mReceivers
* references java.util.HashMap.table
* references array java.util.HashMap$HashMapEntry[].[0]
* references java.util.HashMap$HashMapEntry.key
* references im.dino.dbinspector.fragments.TableListFragment$2.this$0 (anonymous class extends android.content.BroadcastReceiver)
* references im.dino.dbinspector.fragments.TableListFragment.adapter
* references android.widget.ArrayAdapter.mContext
* leaks im.dino.dbinspector.activities.DbInspectorActivity instance

* Reference Key: 0fc69135-029d-4cdd-8820-23a61819907e
* Device: motorola motorola XT1032 falcon_retde
* Android Version: 5.0.2 API: 21 LeakCanary: 1.3.1
* Durations: watch=5342ms, gc=174ms, heap dump=2491ms, analysis=30190ms

* Details:
* Class android.support.v4.content.LocalBroadcastManager
|   static $staticOverhead = byte[] [id=0x12cf1b01;length=40;size=56]
|   static TAG = java.lang.String [id=0x12f8bce0]
|   static mInstance = android.support.v4.content.LocalBroadcastManager [id=0x12f8bd00]
|   static mLock = java.lang.Object [id=0x12f2ea80]
|   static DEBUG = false
|   static MSG_EXEC_PENDING_BROADCASTS = 1
* Instance of android.support.v4.content.LocalBroadcastManager
|   static $staticOverhead = byte[] [id=0x12cf1b01;length=40;size=56]
|   static TAG = java.lang.String [id=0x12f8bce0]
|   static mInstance = android.support.v4.content.LocalBroadcastManager [id=0x12f8bd00]
|   static mLock = java.lang.Object [id=0x12f2ea80]
|   static DEBUG = false
|   static MSG_EXEC_PENDING_BROADCASTS = 1
|   mActions = java.util.HashMap [id=0x12f87f10]
|   mAppContext = com.sample.esource.App [id=0x12cea160]
|   mHandler = android.support.v4.content.LocalBroadcastManager$1 [id=0x12f8bd40]
|   mPendingBroadcasts = java.util.ArrayList [id=0x12f8bd20]
|   mReceivers = java.util.HashMap [id=0x12f87ee0]
* Instance of java.util.HashMap
|   static $staticOverhead = byte[] [id=0x70912ac1;length=48;size=64]
|   static EMPTY_TABLE = java.util.HashMap$HashMapEntry[] [id=0x71308200;length=2]
|   static serialPersistentFields = java.io.ObjectStreamField[] [id=0x71308218;length=1]
|   static DEFAULT_LOAD_FACTOR = 0.75
|   static serialVersionUID = 362498820763181265
|   static MAXIMUM_CAPACITY = 1073741824
|   static MINIMUM_CAPACITY = 4
|   entryForNullKey = null
|   entrySet = null
|   keySet = null
|   table = java.util.HashMap$HashMapEntry[] [id=0x12f8be00;length=4]
|   values = null
|   modCount = 4
|   size = 4
|   threshold = 3
|   keySet = null
|   valuesCollection = null
* Array of java.util.HashMap$HashMapEntry[]
|   [0] = java.util.HashMap$HashMapEntry [id=0x12f8be20]
|   [1] = java.util.HashMap$HashMapEntry [id=0x12c4f3e0]
|   [2] = null
|   [3] = java.util.HashMap$HashMapEntry [id=0x12c0ce60]
* Instance of java.util.HashMap$HashMapEntry
|   key = im.dino.dbinspector.fragments.TableListFragment$2 [id=0x12f890c0]
|   next = null
|   value = java.util.ArrayList [id=0x12f8bde0]
|   hash = -1208629200
* Instance of im.dino.dbinspector.fragments.TableListFragment$2
|   this$0 = im.dino.dbinspector.fragments.TableListFragment [id=0x12f5d8f0]
|   mPendingResult = null
|   mDebugUnregister = false
* Instance of im.dino.dbinspector.fragments.TableListFragment
|   static $staticOverhead = byte[] [id=0x12e68801;length=8;size=24]
|   static KEY_DATABASE = java.lang.String [id=0x12f88fc0]
|   adapter = android.widget.ArrayAdapter [id=0x12c90ec0]
|   database = java.io.File [id=0x12f2aa70]
|   dbCopiedReceiver = im.dino.dbinspector.fragments.TableListFragment$2 [id=0x12f890c0]
|   tableClickListener = im.dino.dbinspector.fragments.TableListFragment$1 [id=0x12f2e980]
|   mAdapter = android.widget.ArrayAdapter [id=0x12c90ec0]
|   mEmptyText = null
|   mEmptyView = null
|   mHandler = android.os.Handler [id=0x12f89080]
|   mList = null
|   mListContainer = null
|   mOnClickListener = android.support.v4.app.ListFragment$2 [id=0x12f2e930]
|   mProgressContainer = null
|   mRequestFocus = android.support.v4.app.ListFragment$1 [id=0x12f2e920]
|   mStandardEmptyView = null
|   mListShown = false
|   mActivity = null
|   mAllowEnterTransitionOverlap = null
|   mAllowReturnTransitionOverlap = null
|   mAnimatingAway = null
|   mArguments = android.os.Bundle [id=0x12f88fe0]
|   mChildFragmentManager = null
|   mContainer = null
|   mEnterTransition = null
|   mEnterTransitionCallback = null
|   mExitTransition = null
|   mExitTransitionCallback = null
|   mFragmentManager = null
|   mInnerView = null
|   mLoaderManager = null
|   mParentFragment = null
|   mReenterTransition = java.lang.Object [id=0x12dc9e70]
|   mReturnTransition = java.lang.Object [id=0x12dc9e70]
|   mSavedFragmentState = null
|   mSavedViewState = android.util.SparseArray [id=0x12e05ac0]
|   mSharedElementEnterTransition = null
|   mSharedElementReturnTransition = java.lang.Object [id=0x12dc9e70]
|   mTag = null
|   mTarget = null
|   mView = null
|   mWho = null
|   mAdded = false
|   mBackStackNesting = 0
|   mCalled = true
|   mCheckedForLoaderManager = false
|   mContainerId = 0
|   mDeferStart = false
|   mDetached = false
|   mFragmentId = 0
|   mFromLayout = false
|   mHasMenu = true
|   mHidden = false
|   mInLayout = false
|   mIndex = -1
|   mLoadersStarted = false
|   mMenuVisible = true
|   mNextAnim = 0
|   mRemoving = false
|   mRestored = false
|   mResumed = false
|   mRetainInstance = false
|   mRetaining = false
|   mState = 0
|   mStateAfterAnimating = 0
|   mTargetIndex = -1
|   mTargetRequestCode = 0
|   mUserVisibleHint = true
* Instance of android.widget.ArrayAdapter
|   mContext = im.dino.dbinspector.activities.DbInspectorActivity [id=0x12d51bc0]
|   mFilter = null
|   mInflater = com.android.internal.policy.impl.PhoneLayoutInflater [id=0x12f64310]
|   mLock = java.lang.Object [id=0x12c765a0]
|   mObjects = java.util.ArrayList [id=0x12dda140]
|   mOriginalValues = null
|   mDropDownResource = 17367043
|   mFieldId = 0
|   mNotifyOnChange = true
|   mResource = 17367043
|   mDataSetObservable = android.database.DataSetObservable [id=0x12c76590]
* Instance of im.dino.dbinspector.activities.DbInspectorActivity
|   mDelegate = android.support.v7.app.AppCompatDelegateImplV11 [id=0x12ca2fc0]
|   mAllLoaderManagers = android.support.v4.util.SimpleArrayMap [id=0x12f7ec80]
|   mContainer = android.support.v4.app.FragmentActivity$2 [id=0x12f429f0]
|   mFragments = android.support.v4.app.FragmentManagerImpl [id=0x12f4bc10]
|   mHandler = android.support.v4.app.FragmentActivity$1 [id=0x12f272e0]
|   mLoaderManager = null
|   mCheckedForLoaderManager = true
|   mCreated = true
|   mLoadersStarted = false
|   mOptionsMenuInvalidated = false
|   mReallyStopped = true
|   mResumed = false
|   mRetaining = true
|   mStopped = true
|   mActionBar = null
|   mActivityInfo = android.content.pm.ActivityInfo [id=0x12f65080]
|   mActivityTransitionState = android.app.ActivityTransitionState [id=0x12f5acc0]
|   mAllLoaderManagers = android.util.ArrayMap [id=0x12f75160]
|   mApplication = com.sample.esource.App [id=0x12cea160]
|   mComponent = android.content.ComponentName [id=0x12c7b0f0]
|   mContainer = android.app.Activity$1 [id=0x12f429c0]
|   mCurrentConfig = android.content.res.Configuration [id=0x12f4bd60]
|   mDecor = null
|   mDefaultKeySsb = null
|   mEmbeddedID = null
|   mEnterTransitionListener = android.app.SharedElementCallback$1 [id=0x71321398]
|   mExitTransitionListener = android.app.SharedElementCallback$1 [id=0x71321398]
|   mFragments = android.app.FragmentManagerImpl [id=0x12f4bba0]
|   mHandler = android.os.Handler [id=0x12f272c0]
|   mInstanceTracker = android.os.StrictMode$InstanceTracker [id=0x12f429d0]
|   mInstrumentation = android.app.Instrumentation [id=0x12c0e1a0]
|   mIntent = android.content.Intent [id=0x12f02140]
|   mLastNonConfigurationInstances = null
|   mLoaderManager = null
|   mMainThread = android.app.ActivityThread [id=0x12c51100]
|   mManagedCursors = java.util.ArrayList [id=0x12f27280]
|   mManagedDialogs = null
|   mMenuInflater = null
|   mParent = null
|   mResultData = null
|   mSearchManager = null
|   mTitle = java.lang.String [id=0x12f27400]
|   mToken = android.os.BinderProxy [id=0x12c78440]
|   mTranslucentCallback = null
|   mUiThread = java.lang.Thread [id=0x745d1480]
|   mVoiceInteractor = null
|   mWindow = com.android.internal.policy.impl.PhoneWindow [id=0x12d0b280]
|   mWindowManager = android.view.WindowManagerImpl [id=0x12f27520]
|   mCalled = true
|   mChangeCanvasToTranslucent = false
|   mChangingConfigurations = true
|   mCheckedForLoaderManager = true
|   mConfigChangeFlags = 1152
|   mDefaultKeyMode = 0
|   mDestroyed = true
|   mDoReportFullyDrawn = false
|   mEnableDefaultActionBarUp = false
|   mFinished = false
|   mIdent = 51785090
|   mLoadersStarted = false
|   mResultCode = 0
|   mResumed = false
|   mStartedActivity = false
|   mStopped = true
|   mTemporaryPause = false
|   mTitleColor = 0
|   mTitleReady = true
|   mVisibleBehind = false
|   mVisibleFromClient = true
|   mVisibleFromServer = true
|   mWindowAdded = true
|   mInflater = com.android.internal.policy.impl.PhoneLayoutInflater [id=0x12f64310]
|   mOverrideConfiguration = null
|   mResources = android.content.res.Resources [id=0x12c0e100]
|   mTheme = android.content.res.Resources$Theme [id=0x12f27540]
|   mThemeResource = 2131296480
|   mBase = android.app.ContextImpl [id=0x12eced80]

ClassCastException while sharing db

W/System.err: java.lang.ClassCastException: im.dino.dbinspector.activities.DbInspectorActivity cannot be cast to im.dino.dbinspector.fragments.PreferenceListFragment$OnPreferenceAttachedListener
W/System.err:     at im.dino.dbinspector.fragments.PreferenceListFragment.onCreate(PreferenceListFragment.java:135)
W/System.err:     at android.support.v4.app.Fragment.performCreate(Fragment.java:2075)
W/System.err:     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1060)
W/System.err:     at android.support.v4.app.BackStackRecord.setLastIn(BackStackRecord.java:838)
W/System.err:     at android.support.v4.app.BackStackRecord.calculateFragments(BackStackRecord.java:878)
W/System.err:     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:719)
W/System.err:     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682)
W/System.err:     at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:594)
W/System.err:     at im.dino.dbinspector.fragments.TableFragment.onOptionsItemSelected(TableFragment.java:209)
W/System.err:     at android.support.v4.app.Fragment.performOptionsItemSelected(Fragment.java:2212)
W/System.err:     at android.support.v4.app.FragmentManagerImpl.dispatchOptionsItemSelected(FragmentManager.java:2295)
W/System.err:     at android.support.v4.app.FragmentController.dispatchOptionsItemSelected(FragmentController.java:353)
W/System.err:     at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:414)
W/System.err:     at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:198)
W/System.err:     at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:107)
W/System.err:     at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:671)
W/System.err:     at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:817)
W/System.err:     at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
W/System.err:     at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:964)
W/System.err:     at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:954)
W/System.err:     at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624)
W/System.err:     at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:157)
W/System.err:     at android.view.View.performClick(View.java:5637)
W/System.err:     at android.view.View$PerformClick.run(View.java:22429)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err:     at android.os.Looper.loop(Looper.java:154)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6119)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Crash when used in AndroidX project

Currently, it is neccessary to also add implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' depndecy to an AndroidX project.

Without the dependency, DB inspector can't resolve LocalBroadcastManager and this will cause a crash when you try to access your DB.

Table not refreshed after being updated through the SQL editor

✍️ Describe the bug

If you execute an SQL query which modifies the table, when you return to the table in question, it will still show old data. Refreshing it manually works, though.

💣 Steps to reproduce

  1. Go to an example table.
  2. Press the "Edit" button
  3. Execute a query that modifies that table (e.g., DELETE FROM example_table)
  4. Return back to the table

🔧 Expected behavior

The table should be automatically refreshed. Ideally, it would refresh the table only if a modifying command on that table was executed, but I think it's fine to have a more broad trigger (e.g., any non-select command on any table was executed); I don't think the refresh action is too problematic.

Improve BLOB representation

⚠️ Please describe your feature request

Currently, all BLOBs are displayed as (data). This is not a very descriptive representation of the stored data.

💡 Describe the solution you'd like

A simple improvement would be to show all BLOBs as a hex string. This would help with data types such as byte arrays.
An advanced improvement would be showing different representation based on the BLOB type. For example, images could be rendered within the cell - possibly initially as a thumbnail with an option to expand.

🙋 Do you want to develop this feature yourself?

  • Yes
  • No

Table filtering

It will be extremely helpful to add ability to execute sql queries or just filter tables by simple conditions, like media_type equals 'audio'

Using unstable dependencies by library

✍️ Describe the bug

For now - version 5.0.0 seems great, but it's based on fragmentx 1.3.0.beta, which is unstable. After upgrading your library to newest version i got a handful of deprecation notices. I'm not really fond of using unstable libraries from google at production applications, so this is a killer problem for me here. Could you consider sticking with stable libraries for stable library releases? A lot of libraries are doing unstable releases and in those releases they can use unstable dependencies too (FlowBinding for example)

Collapse large cell entries by default, add "expand" functionality

⚠️ Please describe your feature request

If the database contains some very long entry (e.g., a JSON response), it can make the entire view very difficult to navigate.

💡 Describe the solution you'd like

I propose a certain character limit after which the entry in a cell would be collapsed by default, with an option to expand it (by tapping the cell or pressing some sort of "Expand" or "Show more" button).

🙋 Do you want to develop this feature yourself?

  • Yes
  • No

kv_default does not show meaningful data

Hi I've been recently evaluating Couchbase Lite for my company's apps, and I think the android db inspector is a pretty cool concept to inspect the contents of our apps's dbs when debugging. But I can't seem to view any meaningful data about my database. In the version and body columns all it shows me is the word (data), like so:

couchbase

I guess I expected it to show me the key/value pairs for each document within the db. Am I missing something?

Incompatible with AppCompat 21+

I'm getting this error when launching the Inspector activity:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference
at im.dino.dbinspector.fragments.DatabaseListFragment.onActivityCreated(DatabaseListFragment.java:41)
at android.app.Fragment.performActivityCreated(Fragment.java:2061)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:912)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:833)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
at android.app.Activity.performStart(Activity.java:5948)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

This is how the relevant manifest entry:


            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

Build fail on processDebugMainManifest

✍️ Describe the bug

Using the latest version (5.2.8). I have this when trying to build on Github Actions (on windows it seems to be working fine):

> Task :app:processDebuggableDevDebugMainManifest FAILED
/__w/Kiru.MobileAndroid/Kiru.MobileAndroid/app/src/debuggable/AndroidManifest.xml:30:9-35 Error:
	Attribute application@supportsRtl value=(true) from AndroidManifest.xml:30:9-35
	is also present at [com.infinum.dbinspector:dbinspector:5.2.8] AndroidManifest.xml:12:18-45 value=(false).
	Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:5:5-20:19 to override.

Build fail on some configurations in 5.2.2

✍️ Describe the bug

I'm trying to assemble the apk with dbinspector, but i have issue with building it on GitHub Actions (ubuntu machine). I have this error

Execution failed for task ':app:processDebuggableDevDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /root/.gradle/caches/transforms-3/031c6876173f7b874f3236044a0b538f/transformed/jetified-dbinspector-5.2.2/res/mipmap-v26/dbinspector_launcher.xml:3: AAPT: error: resource drawable/dbinspector_launcher_background (aka com.ex.dev:drawable/dbinspector_launcher_background) not found.
         
     /root/.gradle/caches/transforms-3/031c6876173f7b874f3236044a0b538f/transformed/jetified-dbinspector-5.2.2/res/mipmap-v26/dbinspector_launcher.xml:4: AAPT: error: resource drawable/dbinspector_launcher_foreground (aka com.ex.dev:drawable/dbinspector_launcher_foreground) not found.
         
     /root/.gradle/caches/transforms-3/031c6876173f7b874f3236044a0b538f/transformed/jetified-dbinspector-5.2.2/res/mipmap-v26/dbinspector_launcher_round.xml:3: AAPT: error: resource drawable/dbinspector_launcher_background (aka com.ex.dev:drawable/dbinspector_launcher_background) not found.
         
     /root/.gradle/caches/transforms-3/031c6876173f7b874f3236044a0b538f/transformed/jetified-dbinspector-5.2.2/res/mipmap-v26/dbinspector_launcher_round.xml:4: AAPT: error: resource drawable/dbinspector_launcher_foreground (aka com.ex.dev:drawable/dbinspector_launcher_foreground) not found.

I do not have any issues building this on my dev windows machine. Do you have an idea why could that be?

Version 5.2.1 works perfectly fine

ClassNotFoundException and crashes at opening..

I'm getting one crash when I try to start Db Inspector activity I got a crash, my app uses multidex I'm not sure if occurs because of that but maybe..


03-02 16:17:32.062  21356-21356/com.displaynote.solano E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.bla/im.dino.dbinspector.activities.DbInspectorActivity}: java.lang.ClassNotFoundException: Didn't find class "im.dino.dbinspector.activities.DbInspectorActivity" on path: /data/app/com.bla-1.apk
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
            at android.app.ActivityThread.access$700(ActivityThread.java:150)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:175)
            at android.app.ActivityThread.main(ActivityThread.java:5279)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "im.dino.dbinspector.activities.DbInspectorActivity" on path: /data/app/com.bla-1.apk
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
            at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
            at android.app.ActivityThread.access$700(ActivityThread.java:150)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:175)
            at android.app.ActivityThread.main(ActivityThread.java:5279)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)

3.0.1 version breaks build, documentation should be updated to reflect changes

For previous versions, we were adding DbInspector activity in our manifests. In 3.0.1 the activity is added in library manifest, which breaks build when we upgrade the library from old version (1.1) to latest(3.0.1). However android studio is kind enough to tell us about tools:replace node. Isn't it good to update readme to reflect this change?

Also, having same label ( android:label="@string/dbinspector_app_name") and icon (android:icon="@drawable/dbinspector_ic_launcher") will likely to create confusion if more than one app uses this library as there will be more than one launcher icons which will have same icon and label/.

Please update readme to reflect these things.

Import existing database file

Hello,

thanks for developing the library. It's very useful. One Feature I currently Need is the Import of an existing database file. It doesn't matter which file Explorer I use, my db isn't exported. What am I doing wrong?

Can't Flattr this

Sorry, content not supported
Unfortunately we can't support flattring this content. 
We couldn't find an owner for it and thus can't flattr it - sorry for that.

Using LIMIT OFFSET for paging cursor results

⚠️ Please describe your feature request

Is it like we are always fetching all records and then moving the cursor to our page limit and offset in the library..
Why are we not fetching only that many records using LIMIT and OFFSET?

💡 Describe the solution you'd like

📊 Describe alternatives you've considered

📄 Additional context

🙋 Do you want to develop this feature yourself?

  • Yes
  • No

Build error after updating Android support libs to v23.2

Using

compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'

along with
debugCompile 'im.dino:dbinspector:3.2.2@aar'

results in the build error:

:app:processDebugResources
/Users/dino/android/dbinspector/dbinspector/src/main/res/menu/dbinspector_fragment_table_list.xml:13: AAPT: No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_menu_copy_mtrl_am_alpha').
/Users/dino/android/dbinspector/dbinspector/src/main/res/menu/dbinspector_fragment_table_list.xml:21: AAPT: No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_menu_share_mtrl_alpha').

 FAILED

If I revert back to 23.1.1 for the support libs, the issue goes away.

Cannot use 5.4.0

✍️ Describe the bug

Trying to use 5.4.0 ends up with:

Execution failed for task ':app:processDebuggableDevDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR:C:\Users\Jakub\.gradle\caches\transforms-3\35bca2fadd1db3e7a978d8a5f1446405\transformed\dbinspector-5.4.0\res\values\values.xml:346:5-351:13: AAPT: error: style attribute 'android:attr/windowBlurBehindEnabled' not found.
         
     ERROR:C:\Users\Jakub\.gradle\caches\transforms-3\35bca2fadd1db3e7a978d8a5f1446405\transformed\dbinspector-5.4.0\res\values\values.xml:346:5-351:13: AAPT: error: style attribute 'android:attr/windowBlurBehindRadius' not found.

Handle permissions

permissions are currently not being handled, so on Android M+ to use it you need to manually set the storage permission in app settings.

Showing databases only when app is killed.

The app is showing only Phone storage databases (see #19) but that too when I follow the same steps in sequence:

  • I start my app
  • Wait for it till it get data from server and create database
  • kill app
  • Open the dbInspectorActivity

If I open the dbInspectorActivity while my main app is running.. It will reopen the app, not database list. May be it a bug, may be it needs documentation

Horizontal scrolling clashing with pull to refresh

✍️ Describe the bug

When scrolling horizontally through the table, if you move your finger slightly downwards instead of a straight line or upwards,
"pull to refresh" function will start activating and horizontal scrolling will stop. This makes it quite difficult to scroll horizontally in some situations - e.g., using your right thumb to scroll right (moving the thumb from left to right).

💣 Steps to reproduce

  1. Go to any table view
  2. Try to scroll horizontally with a slight downward movement.

🔧 Expected behavior

Keep scrolling horizontally once the scrolling starts rather than activating pull-to-refresh during the scrolling gesture.

📱 Tech info

Any device will do.

Icon is broken

✍️ Describe the bug

Icon has weird padding.

💣 Steps to reproduce

  1. Install the app
  2. Observe the icon

🔧 Expected behavior

Icon shouldn't have the white padding.

📷 Screenshots

Screenshot_2021-01-05-20-18-52-313_com_miui_home

📱 Tech info

  • Device: Xiaomi Mi 8
  • OS: Android 10
  • Sentinel version: -

📄 Additional context

Ability to write custom queries

It would be great to have the ability to perform custom queries on a data base, whether to find out a specific query plan execution or to perform joins.

Potentially it can skyrocket the usability of this great product.

I can apply for trying to solve this task. Prior to that, I would need your opinion and confirmation if it can be done.

Can you remove intent-filter please?

Thanks for your great library.

I'd suggest remove intent-filter for the main activity, because I don't wanna my apps create another icon on my launcher even it just apply to the debug release. Especially when you consider there would have many apps using this library. And because this is a library for developers, it would be easy for them to add those XML if they really need this.

And for developers who want this happen, one quick solution is put following statement in your manifest.xml

        <activity
            android:name="im.dino.dbinspector.activities.DbInspectorActivity">
            <intent-filter tools:node="removeAll">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

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.