CodeNewbie Community šŸŒ±

Cover image for Building software for cattle farmers. Part 2. Production errors
Tristan
Tristan

Posted on

Building software for cattle farmers. Part 2. Production errors

Introduction

  • In this series I take you along, week by week as I release my app and update you on all of the challenges I have faced from the previous week.
  • The app I have built is an app that allows cattle farmers to track their calves during calving season

My app on the Google play store

HERE

GitHub code

Table of contents

  1. Production errors
  2. Fixing the errors
  3. New features
  4. This weeks goals

Production Errors

  • Immediately after I published my app it would crash on opening, which was really weird since it worked perfectly on my own test device.
  • To try and fix this problem fast I knew I needed some sort of logging and that is when I discovered Timber and Firebase Crashlynics. I then used THIS video to set both of them up and to create a decent crash reporting system.

  • After coming across THIS Stackoverflow question, I realized the crash was caused by a obfuscation error initiated by proguard. By default, proguard runs in production mode but not in debug mode( the reason my app only worked on my test device).

  • If you are unfamiliar with obfuscation, it shortens the name of classes and the members, which results in reduced DEX file sizes. This is fine but it becomes a problem when working with Firebase database models. Before obfuscation my code would look like this:

data class FireBaseCalf(var calftag: String? = null,
                        var cowtag:String? = null,
                        var ccianumber: String? = null,
                        var sex:String? = null,
                        var details:String?=null,
                        var date: Date? = null,
                        var birthweight:String? = null,
                        var id: String? = null,

                        )

Enter fullscreen mode Exit fullscreen mode
  • But after obfuscation my code would look like this:
data class FireBaseCalf(var a: String? = null,
                        var b? = null,
                        var c: String? = null,
                        var d? = null,
                        var e?=null,
                        var f: Date? = null,
                        var g? = null,
                        var h: String? = null,

                        )

Enter fullscreen mode Exit fullscreen mode
  • Which was causing the crash when my app would fetch data

How to fix obfuscation errors?

  • As it turns out, if we read the documentation, HERE, firebase states that this sort of error will happen if the toObject() method is used. THIS is how I fixed the problem

New Features

  • Some of my users ( my dad) requested the feature of being able to choose the birth date of a calf. To implement this feature I used the combination of THIS YouTube video and THIS documentation, which created a very nice looking date picker:

Android date picker

This weeks goals

  • looking forward to this week I have two main goals I want to accomplish:

1) code refactoring
2) open source contribution

  • I will keep working and create keep everyone updated next week

Conclusion

  • Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.

Top comments (3)

Collapse
 
larrymartin1job profile image
Info Comment hidden by post author - thread only accessible via permalink
Larry Martin

Great job tackling the production errors. The insights on obfuscation and its impact on Firebase models were enlightening. Excited to see how youll integrate new features in future updates.
Professional Notarization in Avondale AZ

Collapse
 
brettneyric profile image
Info Comment hidden by post author - thread only accessible via permalink
Brettneyric

App Development For Startups: Ten Benefits for Your Business Growth
It's great to see your progress in building an app for cattle farmers. While it's exciting to develop and release an app, it's important to keep in mind the potential production errors that may arise. Ensuring the app's functionality and reliability is crucial for the success of your business and the satisfaction of your users. By addressing these issues and continuously improving your app, you can reap the benefits of app development for startups, including increased brand awareness, customer engagement, and revenue growth. Keep up the good work!

Collapse
 
theplebdev profile image
Info Comment hidden by post author - thread only accessible via permalink
Tristan

This comment from @brettneyric is spam. I have reported it and please, no one click the link.

Some comments have been hidden by the post's author - find out more