<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debug_db_banner.png >
# Android Debug Database
## Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications
### Android Debug Database allows you to view databases and shared preferences directly in your browser in a very simple way
### What can Android Debug Database do?
* See all the databases.
* See all the data in the shared preferences used in your application.
* Run any sql query on the given database to update and delete your data.
* Directly edit the database values.
* Directly edit the shared preferences.
* Directly add a row in the database.
* Directly add a key-value in the shared preferences.
* Delete database rows and shared preferences.
* Search in your data.
* Sort data.
* Download database.
* Debug Room inMemory database.
## About me
Hi, I am [**Amit Shekhar**](https://amitshekhar.me), I have 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.
You can connect with me on:
- [Twitter](https://twitter.com/amitiitbhu)
- [YouTube](https://www.youtube.com/@amitshekhar)
- [LinkedIn](https://www.linkedin.com/in/amit-shekhar-iitbhu)
- [GitHub](https://github.com/amitshekhariitbhu)
## [My Personal Blog - amitshekhar.me](https://amitshekhar.me/blog) - High-quality content to learn Android concepts.
### All these features work without rooting your device -> No need of rooted device
### Using Android Debug Database Library in your application
Add this to your app's build.gradle
```groovy
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
```
Using the Android Debug Database with encrypted database
```groovy
debugImplementation 'com.amitshekhar.android:debug-db-encrypt:1.0.6'
```
And to provide the password for the DB, you should add this in the Gradle:
DB_PASSWORD_{VARIABLE}, if for example, PERSON is the database name: DB_PASSWORD_PERSON
```groovy
debug {
resValue("string", "DB_PASSWORD_PERSON", "password")
}
```
Use `debugImplementation` so that it will only compile in your debug build and not in your release build.
That’s all, just start the application, you will see in the logcat an entry like follows :
* D/DebugDB: Open http://XXX.XXX.X.XXX:8080 in your browser
* You can also always get the debug address url from your code by calling the method `DebugDB.getAddressLog();`
Now open the provided link in your browser.
Important:
* Your Android phone and laptop should be connected to the same Network (Wifi or LAN).
* If you are using it over usb, run `adb forward tcp:8080 tcp:8080`
Note : If you want use different port other than 8080.
In the app build.gradle file under buildTypes do the following change
```groovy
debug {
resValue("string", "PORT_NUMBER", "8081")
}
```
You will see something like this :
### Seeing values
<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debugdb.png >
### Editing values
<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debugdb_edit.png >
### Working with emulator
* Android Default Emulator: Run the command in the terminal - `adb forward tcp:8080 tcp:8080` and open http://localhost:8080
* Genymotion Emulator: Enable bridge from configure virtual device (option available in genymotion)
### Getting address with toast, in case you missed the address log in logcat
As this library is auto-initialize, if you want to get the address log, add the following method and call (we have to do like this to avoid build error in release build as this library will not be included in the release build) using reflection.
```java
public static void showDebugDBAddressLogToast(Context context) {
if (BuildConfig.DEBUG) {
try {
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
Method getAddressLog = debugDB.getMethod("getAddressLog");
Object value = getAddressLog.invoke(null);
Toast.makeText(context, (String) value, Toast.LENGTH_LONG).show();
} catch (Exception ignore) {
}
}
}
```
### Adding custom database files
As this library is auto-initialize, if you want to debug custom database files, add the following method and call
```java
public static void setCustomDatabaseFiles(Context context) {
if (BuildConfig.DEBUG) {
try {
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
Class[] argTypes = new Class[]{HashMap.class};
Method setCustomDatabaseFiles = debugDB.getMethod("setCustomDatabaseFiles", argTypes);
HashMap<String, Pair<File, String>> customDatabaseFiles = new HashMap<>();
// set your custom database files
customDatabaseFiles.put(ExtTestDBHelper.DATABASE_NAME,
new Pair<>(new File(context.getFilesDir() + "/" + ExtTestDBHelper.DIR_NAME +
"/" + ExtTestDBHelper.DATABASE_NAME), ""));
setCustomDatabaseFiles.invoke(null, customDatabaseFiles);
} catch (Exception ignore) {
}
}
}
```
### Adding InMemory Room databases
As this library is auto-initialize, if you want to debug inMemory Room databases, add the following method and call
```java
public static void setInMemoryRoomDatabases(SupportSQLiteDatabase... database) {
if (BuildConfig.DEBUG) {
try {
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
Class[] argTypes = new Class[]{HashMap.class};
HashMap<String, SupportSQLiteDatabase> inMemoryDatabases = new HashMap<>();
// set your inMemory databases
inMemoryDatabases.put("InMemoryOne.db", database[0]);
Method setRoomInMemoryDatabase = debugDB.getMethod("setInMemoryRoomDatabases", argTypes);
setRoomInMemoryDatabase.invoke(null, inMemoryDatabases);
} catch (Exception ignore) {
}
}
}
```
### Find this project useful ? :heart:
* Support it by clicking the :star: button on the upper right of this page. :v:
### TODO
* Simplify emulator issue [Issue Link](https://github.com/amitshekhariitbhu/Android-Debug-Database/issues/6)
* And of course many more features and bug fixes.
You can connect with me on:
- [Twitter](https://twitter.com/amitiitbhu)
- [LinkedIn](https://www.linkedin.com/in/amit-shekhar-iitbhu)
- [GitHub](https://github.com/amitshekhariitbhu)
- [Facebook](https://www.facebook.com/amit.shekhar.iitbhu)
[**Read all of my blogs here.**](https://amitshekhar.me/blog)
### License
```
Copyright (C) 2022 Amit Shekhar
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.
```
### Contributing to Android Debug Database
All pull requests are welcome, make sure to follow the [contribution guidelines](CONTRIBUTING.md)
when you submit pull request.
没有合适的资源?快使用搜索试试~ 我知道了~
Android-Debug-Database.zip
共141个文件
java:54个
xml:23个
png:18个
需积分: 5 0 下载量 149 浏览量
2023-08-18
09:22:28
上传
评论
收藏 1.21MB ZIP 举报
温馨提示
Android-Debug-Database
资源推荐
资源详情
资源评论
收起资源包目录
Android-Debug-Database.zip (141个子文件)
gradlew.bat 2KB
bootstrap.min.css 118KB
jquery.dataTables.min.css 13KB
buttons.dataTables.min.css 8KB
responsive.dataTables.min.css 4KB
select.dataTables.min.css 4KB
custom.css 1KB
.gitignore 216B
.gitignore 7B
.gitignore 7B
.gitignore 7B
debug-db-encrypt-upload.gradle 3KB
debug-db-base-upload.gradle 3KB
debug-db-upload.gradle 3KB
build.gradle 2KB
build.gradle 2KB
build.gradle 1KB
build.gradle 1KB
build.gradle 834B
settings.gradle 829B
build.gradle 760B
gradlew 5KB
index.html 6KB
favicon.ico 1KB
gradle-wrapper.jar 55KB
RequestHandler.java 15KB
DatabaseHelper.java 15KB
TableNameParser.java 10KB
PrefHelper.java 8KB
MainActivity.java 6KB
ContactDBHelper.java 5KB
MainActivity.java 5KB
ContactDBHelper.java 5KB
PersonDBHelper.java 5KB
CarDBHelper.java 4KB
CarDBHelper.java 4KB
Utils.java 4KB
Utils.java 3KB
Utils.java 3KB
ExtTestDBHelper.java 3KB
ExtTestDBHelper.java 3KB
ClientServer.java 3KB
DebugDB.java 3KB
DebugDBInitProvider.java 3KB
DatabaseFileProvider.java 2KB
DebugDBEncryptInitProvider.java 2KB
ConverterUtils.java 2KB
NetworkUtils.java 2KB
DebugEncryptSQLiteDB.java 1KB
ExampleInstrumentedTest.java 1KB
InMemoryDebugSQLiteDB.java 1KB
ExampleInstrumentedTest.java 1KB
DebugSQLiteDB.java 1KB
UserDBHelper.java 1KB
TableDataResponse.java 1KB
UserDBHelper.java 1KB
DataType.java 1KB
Constants.java 1KB
ExampleUnitTest.java 1KB
ExampleUnitTest.java 1KB
Response.java 1KB
RowDataRequest.java 954B
UpdateRowResponse.java 882B
UserDao.java 770B
UserDao.java 762B
ExampleInstrumentedTest.java 747B
ExampleInstrumentedTest.java 731B
ExampleInstrumentedTest.java 720B
SQLiteDB.java 637B
DebugDBEncryptFactory.java 509B
DebugDBFactory.java 435B
ExampleUnitTest.java 390B
ExampleUnitTest.java 382B
ExampleUnitTest.java 379B
AppDatabase.java 359B
AppDatabase.java 351B
User.java 299B
User.java 291B
DBFactory.java 167B
jquery.min.js 85KB
jquery.dataTables.min.js 81KB
bootstrap.min.js 36KB
dataTables.altEditor.free.js 27KB
dataTables.buttons.min.js 16KB
app.js 14KB
dataTables.select.min.js 10KB
dataTables.responsive.min.js 10KB
LICENSE 11KB
README.md 7KB
CHANGELOG.md 2KB
CONTRIBUTING.md 374B
debugdb.png 399KB
debugdb_edit.png 376KB
debug_db_banner.png 172KB
ic_launcher_round.png 15KB
ic_launcher.png 10KB
ic_launcher_round.png 10KB
ic_launcher.png 9KB
ic_launcher.png 8KB
ic_launcher_round.png 7KB
共 141 条
- 1
- 2
资源评论
hello_中年人
- 粉丝: 7
- 资源: 324
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功