Most Useful Tools for logging & debugging
- Fabric Crashlytics (Firebase) & Answer
- Android Debug Database
Major things missing in android app development
- Not able to check & view shared preference variables
- For logging (standard logging) always need to give tags.
- Remotely view logs for all devices.
- Database access is very difficult.
- Inspect elements.
1. Fabric Crashlytics (Firebase) & Answer
Requirement: At the time of development we always faced errors, exceptions, and crashes and tracked by Android Logging system. But it will be a nightmare to find a bug in production which occurs on user’s device. ‘Fabric’s Crashlytics’ provide a solution for that. Crashes and exceptions can be logged with them from remote devices.
- Able to log errors and exception an complete stack trace for remote devices
- Can log for ‘debug’ as well as for ‘production’.
- Also, provide details of device models.
- All the crashes and exceptions will be notified via email, every time they occur.
- Crashes reported automatically.
- To log caught exceptions crashlytics.logException(exception);
- We can also provide some key-value pair for more reference of exception.
- Sometimes didn’t get complete context of a class where an error occurs.
- Android logs for crashes are sometimes difficult to understand.
Stetho is mainly a debugging tool for Android application by Facebook. It uses Chrome’s Developer tool to display debugging data of application.
- View Hierarchy
- Database inspection
- Shared Preferences
- Java Script Console
2.1 View Hierarchy: Able to view all the View elements and detailed properties (styles). The user will have a complete hierarchy view of layout including layouts which were integrated at runtime.
2.2 DataBase Inspection: User can view complete database tables and also able to do the query for some specific data and also alter the data directly from here.
2.3 Shared Preferences: User can view all the shared preferences variables and also changes these values.
2.4 Network Inspection: User can view all the network request and JSON response, image preview of application.
2.6 Dumpapp: Provided command line interface for the Android application.
Integration: Follow the below link
When user run the code than He will see request and response in ‘Network’ tab of Developers tool.
Inspection Process Once a user is done with the integration process
- Open chrome browser in the developer system.
- Navigate to ‘chrome://inspect’.
- Here user will find all the connected devices with the Application name.
- Click ‘inspect’ to start the inspection.
3. Timber’s Requirement:
- Do not require to specify ‘TAG’ for class context like ‘Android log system. Its timber’s inbuilt feature.
- Can control which kind of logs want to show in crashlytics. For Example errors and exceptions. It will not show ‘info’ and ‘warnings’ log in crashlytics
- We can print line-number as well with the logs.
- Provide all logging methods, provided by ‘Android logging system’. Like, debug, info, error, wtf etc
- Firstly follow Timber Integration instruction
- Add the following in app level gradle file
//gradle depedency implementation 'com.facebook.stetho:stetho-timber:1.4.2'
- In Application, class add below code
Now timber provides all kind of logging eg. debug, info, verbose etc in ‘Developer tool’s console’. Do not need to add ‘TAG’, just add messages where ever it is required.
- Do not work for remote devices.
- Logging can’t be saved.
The remote logging system for iOS and Android application.
Why Bugfender? At the time of development
- Logs from many devices required.
- Not possible to attach all the devices with the development machine.
- Need to check some special values on some events fire.
- The log will be saved on cloud and log file can be downloaded as well.
- Logged all remote devices logs.
- Logs saved on the cloud also.
- The free version provides last 24 hours logs.
- Shows different logs for different devices.
- One can enable/disable devices as well as logging on those devices.
- Have different methods to print UI logs, all events logs(complete Android system logs).
- The developer can log only particular event logs.
Read more for Bugfender Integration
5. Android Debug Database
Allows you to view databases & shared preferences in your development machine browser.
- View database.
- Run sql query to modify or delete data from DB.
- View/edit/delete shared preferences of application.
- Directly edit the database values.
- Search and sort data.
- Download database.
- Development machine & device should be in the same network.
Integration: Follow the link