

You can even log and check the values of your variables at runtime. With logging, you can find out what’s happening at certain points within your code.

The first debugging approach is to add logging to your app. Whoops! To understand why this happens, you need to begin analyzing the code. Notice anything strange? TimeFighter resets the game when you rotate the device. Rotate the device, notice something different? To do this, swipe the notification drawer down to reveal the quick settings and ensure the auto-rotate button is colored green to signify it’s enabled. You may need to enable auto-rotate on your device or emulator if the screen doesn’t rotate automatically. Note: For devices running Android Pie and above. Push TAP ME a few times, and then change the orientation of the device to landscape. Start the app in the emulator or on your device. You might not have noticed, but TimeFighter has a bug. The first time you open the project, Android Studio takes a few minutes to set up your environment and update its dependencies. Locate the projects folder for this chapter and open the TimeFighter app inside the starter folder. If you’ve been following along, open your project in Android Studio and keep using it for this chapter. Debug your app using Android Studio’s debug tools.As a developer, it’s your job to keep your app bug-free.Īndroid Studio provides developers with some tools to help track down and fix bugs. Some are subtle, such as glitches within the UI, while others are obvious, such as outright crashes. In this chapter, you’ll focus on debugging it.Īll apps have bugs. In the previous two chapters, you developed TimeFighter into a full-fledged app. Section IV: Building a Podcast Manager & Player Section 4: 8 chapters 16.6 Adding the architecture components.16.3 Room and Android Architecture Components.14.3 Creating the location services client.13.9 The difficulty of determining locations.Section III: Creating Map-Based Apps Section 3: 7 chapters 11.5 Wiring Up the FloatingActionButton.11.4 Adding the ListSelectionFragment to MainActivity.10.5 Passing the Task to the RecyclerView.8.6 Showing Real Lists in the RecyclerView.7.4 Hooking up a RecyclerView using ViewBinding.Section II: Building a List App Section 2: 7 chapters 2.2 These are not the SDKs you’re looking for.1.7 Installing new versions of Android Studio.Section I: Your First Android App Section 1: 5 chapters
