Top 4 Tips for Android Development – 4 of…
Despite the growing pains, I learned a lot from streaming on my old laptop
It was slow and occasionally it would crash. To avoid these issues, Thanks to these (frequent) happy accidents, I came up with my Top 4 Tips for building Android apps. For more on this, watch the video at the bottom of the page. For the source code, click HERE.
1. Android Virtual Device
To quote one of my professors, open the android emulator BEFORE you do anything else. It saves you a lot of time in the long run.
Depending on your system specs, it can take anywhere between 2 and 5 minutes to get your emulator up and running. In my case, on stream, it took at least ten minutes each time.
And that’s when it DECIDED to work.
I also decided to delete my AVD and create a new one (Nexus 5 running Lollipop). It kept crashing or bootlooping during my streams. By downgrading the OS to a smaller, faster AVD, I got it to run consistently. While it’s not a Google Pixel and it doesn’t have Android R, it’s stable and I can still use it to test apps on this machine.
2. Managing Files
Through some tinkering, I realized a key part of importing files in your Android Studio project. Make sure the file is ALSO located inside the project directory. Android studio lets you add images to your projects but they won’t actually render unless the file is located inside the project directory. This is the fix I used when I ran into this issue.
3. Custom Strings
Storing custom strings and colors makes it easier to reuse values in multiple places. If ever the string needs to be updated or translated to another language, you can update every occurrence via the strings.xml file.
I recently decided to apply this by adding custom strings and colors in the res/values/strings.xml and res/values/color.xml files respectively.
You can find examples of custom strings in apps like YouTube and Trello. On certain accounts you’ll see the creator’s name in the appbar along with a color corresponding with their channel. On the other hand, Trello updates the appbar with the name of the current board/card. The String stored in the title is copied and displayed depending on the scroll distance and device orientation.
4. Finding Images
Nappy.co and Pixabay.com offer a lot of royalty free images. These can be perfect for finding backgrounds, dummy user photos, etc. This is what I did to find backgrounds for the Daily Inspiration app.
Now that I have a new emulator configured, I should be able to move forward with this app. Next time I’ll work on adding a background and styling the appearance of the app.
For more on this, watch the video below.
Join the mailing list to see updates like this every week!
Coding Fanatic