In this post, I will tell you all android logging library and debugging tool. Logging android app helps you to debug a bug and exception in local or remote. It can be production and development environment. Few things you can logging android studio
In development mode, you are always faced errors, exceptions, and crashes. It can be tracked by android logging system or Logcat. When it’s come in production app, it not easy to debug because in the users’ device can be so many reasons for any mishappening, such as low network connectivity, device configuration, memory, CPU uses etc. I will tell you all android logging library and debugging tool that help you to find out real problem local and remote as well
Crashes and exceptions can be logged local and remote server as well. Debugging & Logging android app is compulsory to build a pro android application.
Major problem in android app development
- You can not check & view shared preference variables – View the shared preference and local database is not easy in android studio.
- For logging (standard logging) always need to give tags. Basically, In a big team follow the same logging standard by all developers is not easy. I will discuss some libraries that provide a centralized logging system in all app.
- Remotely view logs for all devices – We can debug and log locally, mean those are connected in Android Studio via USB debugging. Android logging system does not provide remote logging solution.
- Database access is very difficult – Check the database data little bit tricky in android app development
- Inspect elements – Inspect all element and network call is not easy and trackable
Following most debugging tools and libraries for logging android app
- Android Debug Database
- Fabric Crashlytics (Firebase) & Answer
The remote logging system for iOS and Android application. Bugfender is a best for remote logging android app. You can log each event with a custom parameter in an orgenized way. You can easily debug what went wrong of user device using logging android
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.
- You can setup cloud-based logging.
- Bugfender provides 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.
2. Fabric Crashlytics (Firebase)
For all types crash ‘Fabric’s Crashlytics’ provide a solution for that. Fabric’s SDK logged all crashes and exceptions remotely with user device configuration
- Able to log errors and exception an complete stack trace for remote devices
- Gives log for debug as well as for production environment.
- It provides all 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 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 and logging library for Android apps. It developed by Facebook. It uses Chrome’s Developer tool to display debugging data of apps. You can debug all things in local using logging android app.
- View Hierarchy
- Database inspection
- Shared Preferences
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 views 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
User runs the code, He will see request and response in the ‘Network’ tab of Developers tool.
Inspection Process- You have done with all integration steps than move to chrome browser
- 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.
4. Timber’s Requirement:
Timber is a logging library that manage all log in organised way logging android studio.
- 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. eg. 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
- Follow the timber integration instruction
- Add the following in-app level Gradle file
//gradle dependency 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.
5. Android Debug Database
This android logging library 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