May 2022
Intermediate to advanced
688 pages
20h 12m
English
In this chapter, you will find out what to do when apps get buggy. You will learn how to use Logcat, Android Lint, and the debugger that comes with Android Studio.
To practice debugging, the first step is to break something. In MainActivity.kt, comment out the code in onCreate(Bundle?) where you initialize binding.
Listing 5.1 Commenting out a crucial line (MainActivity.kt)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d(TAG, "onCreate(Bundle?) called")
// binding = ActivityMainBinding.inflate(layoutInflater)
...
}
Run GeoQuiz and see what happens. The app will crash and burn almost immediately.
If you watch the screen, you may see the app appear ...
Read now
Unlock full access