Toptal acquires, enhancing custom software leadership

Android Studio: 5 troubles for beginners and their solutions

29.09.2016 Margaret Geras
Leave a Comment
Android Studio: 5 troubles for beginners and their solutions

Those starting to work with a new platform fall into the same traps and pitfalls which are not so evident from the very beginning. Most of them are related to coding and include (but unfortunately are not limited to) API discrepancies, hidden functions, constraints, and peculiarities of the programming style for the given platform. Other hidden pitfalls get uncovered at later stages and come out during the testing and automatic optimization, icon generation process, clipart and automatic crash reports. Both, however, might be equally perplexing for inexperienced Android developers.

This article can serve as an Android studio tutorial which addresses Android app development challenges in the context of utilities and tools. Additionally, you’ll learn how to perform the application testing and debugging on your phone without cable connection, split the app into Lite and Pro versions, integrate the mechanism of automatic crash reports generation, automate testing, and optimize the code, reduce the time spent on icons and other app resources development to just few minutes. Off we go!

  1. Slow emulator

So you’ve drafted your first application and can’t wait to run and test it. This is when an emulator from Android SDK comes in handy. For a long time it was criticized for its slowness, but Android Studio 2.0 has become a game changer. X86 emulator version came with hardware acceleration, so now it works faster than real devices. Android Developers have also appreciated a user-friendly graphic interface of the new version. Instead of using command-line tools one can simulate network crashes, incoming phone calls and text messages, play with the GPS location of the device etc. just using the emulator controls.

Update your Android SDK to make sure to choose X86 emulator in AVD manager as ARM version does not support hardware acceleration.

  1. Smartphone on a leash

Step two is testing on a real device. It’s no-brainer: connect the smartphone via USB, install drivers, turn on debugging developer options, and find your smartphone in the list of devices available for installing the app (next to the emulator). The only problem is that in such circumstances your phone should remain connected to the PC all the time, which can be quite uncomfortable if it is the same smartphone you use for phone calls.

Fortunately, Android Studio (or rather, one of its utilities called ADB providing communication between devices) supports wireless connection as well. However, this function must be activated. This is easy as pie for owners of rooted smartphones as they can activate wireless debugging with WiFi ADB app. So here is what you should do:

  1. Install and run WiFi ADB, select the wireless mode and make sure to remember the IP-address.

  2. Run Android Studio.

  3. Open the console, from SDK platform-tools / directory run the following command:

$ adb connect IP-address

Now, if you try to run the application, you will see your smartphone on the list of available devices. Those whose phones have no root access can restart ADB in wireless mode after connecting it via USB. Here’s the way how to do it:

  1. Connect your smartphone and install the drivers.

  2. Turn on debugging in Developer options.

  3. Open the console, from SDK platform-tools / directory run the following command:

$ adb tcpip 5555

  1. Connect your smartphone over the network:

$ adb connect IP-address

IP-address can be found via Settings > About tablet (or About phone) > Status > IP address. Just click “IP-address”.

  1. Libraries

Okay, your freshly-developed app seems to be working. It’s time to convert it to a really cool app with appealing interface and desktop widgets. At this stage you will surely need external libraries that implement different interface concepts, programming patterns and communication with external services. And if the last is trivial – if you need an SDK for Dropbox, you just open developmental portal and follow instructions – the other tasks are more challenging. Where to look for libraries and which one is best?

The most comprehensive catalogue of libraries is Android Arsenal. There you will find almost everything you need. The portal allows user-friendly search and sorting by the rate, each library comes with instructions on how to connect it to your project, including Gradle, build system standard for Android: just add the repository in the build.gradle file of the project and specify the library in the dependency list.

I’d recommend to first-time Android developers to start with Dagger 2, RxJava and Retrofit. After you learn how to use android studio and become an advanced developer, you’ll end up using other libraries.

  1. Icons and Graphics

Days or weeks afterwards your application is finally becoming more and more functional. The only thing that gives away its incompletion is the total absence of graphics: a standard green robot icon and plugs instead of clip arts. It doesn’t look exciting enough to enter the market, right?

Again, you can change that. There is a wonderful web service Android Asset Studio which reduces the time spent on icon design. As a result, you get a beautiful icon in all possible resolutions. Your new web icon can be customized from any image or text that you have prepared, or chosen from the graphics available on the site. Also, this service lets you choose the icon shape (round, square, iOS style), color, shadows adjustment and other parameters. As a result, you will receive archive which should be extracted in the catalogueAndroidstudioProjects/APPLICATION_NAME/app/src/main/res.

This service is also suitable for creating icons for ActionBar’s and status bar. The principle is about the same. In addition, you will need the so-called Feature Image. This is an image used by Play Market and other application stores at the top of the listing (users see it when they open the application page on their smartphone). It can be generated using other service. Official Google service for wrapping up screenshots creates a screenshot frame for the smartphone.

  1. Crash-reports

So your app is ready, it has an icon already as well as a user-friendly interface and impeccable lines of code. It’s high time to test it, and start sending it to your friends and relatives afterwards. If your app works on your device, it doesn’t mean it’ll work smoothly on others. So what do you do now? Ask them to send your logcat listing?

Well, a crash reporting system would be a much better idea. Though there are plenty of them. All crash reporters follow the same operating scheme: a small library gets connected to the app and records stack trace and other crash-related data during crashes. The data is forwarded to the server, and then a special web interface transforms it into visual and informative crash reports.

These are the very first 5 steps to be fulfilled on your way to ideal application either it’s build on Android or iOS. Educate yourself and maybe one day you’ll become a real developer!

Please, rate my article. I did my best!

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Leave a Reply