Android Debug Database

來源:互聯網
上載者:User

標籤:debugging   提示   uil   licensed   end   public   https   either   調用   

https://github.com/amitshekhariitbhu/Android-Debug-Database

為了閱讀方便,翻譯一下。。。

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 :

你將會看到類似的圖:

 

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 = 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 Project   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 為ADD做貢獻

Just make pull request. You‘re in! 拉動需求。包括你。

Android Debug Database

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.