Create New Project
Of course, it’s the first step when you want to create new Android Studio project. It seems to be easy but for beginners, it’s not so obvious. I was doing it wrong too. If you don’t look like the guy in the picture- continue. It’s down-to-earth tutorial for beginners! Creating new project…
There are some things that you have to do:
Set Company Domain
Wtf is that? Well, Android uses it to determine is an app installed on device or not. It’s better to make this name unique. If you don’t have company, use website name/your nick/full name.
Usually, it goes like “com.company_name.app_name”. For example, I’m going to use “com.theandroiddev.mywins”. So I type “MyWins” as app name and “theandroiddev.com” as company domain. Don’t leave “example” in the name. It’s reserved and you may have problems with uploading the app to google play.
Picking the best API levels
Next thing that you have to know is API level basics. API allows you to access somebody’s code. In this case thanks to API you will be able to use Android public methods and rules. Bigger API level means newer Android versions and more features. So why shouldn’t you pick the highest API level?
Unfortunately, some Android devices won’t run apps above certain API level. That means you have to balance it. Keep as many devices supported as possible but not at any price. That’s because some older APIs are no longer popular.
I want to show you some stats. That’s 2017 chart that I created right now. It shows API percentage popularity. I skipped some APIs due to really tiny popularity.
Ok, so what does it mean? Well, it means that if you don’t want to lose a big percentage of users- you should pick API 16. Nevertheless, API 21 will kill some users but only a few percent of them. And it will save you some time because…
It will be easier to for example add animation and sometimes change color on API 21. If you want to use it on lower API device, you will have to use two versions of a file. For your minimum API and for API needed to execute your code. For example activity_main.xml and activity_main.xml (v-21). That’s harder but only a little bit. I’m going to pick API 16 for MyWins project.
Pick the Best Main Activity Template
In project creator very last window wants you to pick first activity type. Generally, there are 2 reasonable templates. Pick Basic Activity to get FAB (bottom right “+” button), ActionBar and few additional files by default. Or pick Empty Activity that contains only essentials. I recommend you second option because you have to learn how to implement it on your own. Furthermore, Basic Activity is not always up to date and can provide not the best/trashy code. I know that Empty Activity may seem to be nerdy but don’t be afraid, pick it. 😉
BTW. Next window asks you for Backwards Compatibility (AppCompat). This is a set of support libraries. It allows you to develop code for higher API supporting lower APIs too. You should keep it checked.
Send the Project to GitHub
It’s OK to store project locally but it’s better to keep it on GitHub. It allows you to:
- use it on any other computer
- share it with other developers
- work in a group
- track code changes
GitHub is very popular, you can find it everywhere. I’m not going to write setup instructions here. It deserves a standalone post to cover everything about it. Consider using it. You may follow me too. It’s a new account created for this blog purpose.
That’s All You Need Now
It’s everything that you need to set up a new project properly. Usually, people that write tutorials don’t spend too much time on doing it. But if you are going to develop a full project, not a shitty piece of code- it’s good to know it. Check my MyWins App Tutorial Journey and make it your win too. Have a clean project, buddy. I’m outta here!