Android Debug Database

贵有恒,何必三更起、五更眠、最无益,只怕一日曝、十日寒。这篇文章主要讲述Android Debug Database相关的知识,希望能为你提供帮助。

Android Debug Database

文章图片

https://github.com/amitshekhariitbhu/android-Debug-Database
为了阅读方便,翻译一下。。。
实践过程:http://www.cnblogs.com/hbuwyg/p/7045722.html
Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications.ADD 是一个在Android应用开发时 调试 数据库和共享参数 的 强大的库。
Android Debug Database allows you to view databases and shared preferences directly in your browser in a very simple way.
ADD用简单的方法   在你的浏览器中   直接查看数据库和共享参数。
What can Android Debug Database do?
ADD在调试数据库时能做什么?
  • 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. 在给定数据库上   使用sql查询 可以更新和删除数据。
  • Directly edit the database values. 直接编辑数据库的值。
  • Directly edit shared preferences.   直接编辑共享参数的值。
  • Delete database rows and shared preferences. 删除数据库行和共享参数。
  • Search in your data. 数据中查找。
  • Sort data. 数据排序。
  • Download database. 下载数据库。
All these features work without rooting your device -> No need of rooted device   所有的这些功能都无需root设备 → 无需root设备
Check out another awesome library for fast and simple networking in Android.   看看另一个很棒的库,用于Android中快速简洁网络操作。
  • Fast Android Networking Library
Using Android Debug Database Library in your application   如何在你的应用中使用ADD
Add this to your app\'s build.gradle 把下面这段代码加入到你的app的build.gradle文件中
debugCompile \'com.amitshekhar.android:debug-db:1.0.0\'

Use  debugCompile  so that it will only compile in your debug build and not in your release apk.
使用debugCompile  (debug编译)以便于它只会在你debug时编译,release apk时不会执行。
That’s all, just start the application, you will see in the logcat an entry like follows : 好了,启动应用,你将会在logcat中看到如下的入口:
  • 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(); 你也可以在代码中调用DebugDB.getAddressLog()方法,获取debug地址。
Now open the provided link in your browser. 现在在浏览器中打开提供的连接。
Important:重要提示:
  • Your Android phone and laptop should be connected to the same Network (Wifi or LAN). 你的Android手机和笔记本电脑必须在同一个网络(WiFi或局域网)
  • If you are using it over usb, run  adb forward tcp:8080 tcp:8080 如果你是通过USB连接,运行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
注意:如果你想使用8080以外的端口。在程序的build.gradle文件的buildTypes下,做如下更改
debug { resValue("string", "PORT_NUMBER", "8081") }


You will see something like this :
你将会看到类似的图:
Android Debug Database

文章图片

Android Debug Database

文章图片

 
Working with emulator 配合模拟器使用
  • Android Default Emulator: run  adb forward tcp:8080 tcp:8080  and open  http://localhost:8080  Android默认模拟器:运行adb forward tcp:8080 tcp:8080  ,打开  http://localhost:8080 
  • Genymotion Emulator: Enable bridge from configure virtual device (option available in genymotion)  Genymotion 模拟器:配置虚拟设备的桥,使之有效(Genymotion 的有效选项)
Getting address With toast, in case you missed the address log in logcat 使用toast获取地址,万一你错过了在logcat中的地址日志
As this library is auto-initialize, if you want to get the address log, add the following method and call 由于这个库是自动初始化,如果你想获取地址日志,加入下面的方法并调用
public static void showDebugDBAddressLogToast(Context context) { if (BuildConfig.DEBUG) { try { Class< ?> debugDB = Class.forName("com.amitshekhar.DebugDB"); Method getAddressLog = debugDB.getMethod("getAddressLog"); Object value = https://www.songbingjia.com/android/getAddressLog.invoke(null); Toast.makeText(context, (String) value, Toast.LENGTH_LONG).show(); } catch (Exception ignore) {} } }

Find this project useful ?    觉得这个项目有用吗?
  • Support it by clicking the star  button on the upper right of this page.    支持一下,点击本页面右上角的五角星按钮。
TODO 备忘录
  • Simplify emulator issue  Issue Link  简化模拟器问题
  • And of course many more features and bug fixes. 当然还存在一些bug需要修正,需要扩展出更多功能。
Check out Mindorks awesome open source projects here  查看Mindorks的出色的开源项目
Contact - Let\'s become friends 联系- 让我们变为朋友
  • Twitter
  • Github
  • Medium
  • Facebook
License 许可
Copyright (C) 2016 Amit Shekhar Copyright (C) 2011 Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless 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 为ADD做贡献
【Android Debug Database】Just make pull request. You\'re in! 拉动需求。包括你。

    推荐阅读