How to debug Android applications when your emulators are slow
How to debug Android applications when your emulators are slow?
This is one of the most common problems you face when you don’t have a high end machine to run the Android Emulator. As you know, the Android emulator is damn slow and especially if you want to work with the Google API version 18 or above then it really sucks. To render Google maps on emulator is a pain.
I’ve figured a easy way on how you can overcome this problem. If you have an Android mobile which can be plugged to your laptop/computer via a USB, then you can easily debug or find the stack trace of the error rather than waiting to run in emulator. Here is what you need to do. You should be having Android Studio or Eclipse ADT.
- At first let’s get the android SDK from here – http://developer.android.com/sdk/index.html
Install Andriod SDK
Open SDK manager and install
- Android SDK tools
- Android SDK platform tools,
- Google USB Driver.
Now get your mobile and ensure before connecting the handset to the laptop/computer using USB cable, switch on USB debugging in mobile device.
This can be done by going to Settings-> Applications-> Development and check the box USB debugging in your handset.
Go to command prompt (Run->cmd) and go to platform-tools location as shown below.
In the platform-tools location, type adb logcat > log.txt and enter as shown below.
C:\Users\user\AppData\Local\Android\sdk\platform-tools>adb logcat > log.txt
This will start creating a log.txt file in the platform-tools location
- Now try to create a crash in your application and see where the bug is occurring that makes the application to crash
To stop the logcat, do a Ctrl + c
- Open the log.txt file you will get stack trace of the crash. This will help you to identify the issue.
After going thru lot of posts and the complications of having Hyper-V vs X86 problems, genymotion, virtualbox blah.. blah.. I found this as a simple workable solution.
I hope this will help to debug your Android application which you were unable to do on a slow emulator.
- Android Installation
- Android Basics
- Android Drawables
- Android Architecture
- Debugging Android
- Android Style and Android Screen Size
- Android Fragment
- Android Menus and Action Bar
- First Android Project
- Android Layout
- Android Exception
- Android Development
- Ten things an Android developer should know
- Eight common mistakes that Android developers do
- New Android Interview Questions and Answers for beginners
- How to debug Android applications when your emulators are slow