This article will encourage you how to setup and run an Android project utilizing Android Studio on OS X (Windows and Linux are very little unique). This will be a starter project for all other project tutorials.
How to code is sufficiently troublesome all alone however with Android Programming it can be more entangled. Not only do you have to comprehend Java, you likewise need to introduce all the Android-particular software and take in the majority of the one of a kind eccentricities of Android application development.
Install Android Studio
The most widely recognized IDE for Android development is Android Studio, which comes coordinate from Google itself. An IDE is the thing that gives you the fundamental UI where you’ll enter your code (you can’t simply begin composing into scratch pad). It additionally features things you get wrong, offers suggestions and gives you a chance to run and test your program. It will automatically generate basic layout and saves your time.
There are a few contrasting options to Android Studio. Eclipse is a older version IDE that can be utilized for creating different things as well, (for example, iOS applications) and that is more adaptable. It’s likewise a significantly more fiddly to begin with however and not so user friendly.
There are different alternatives as well, for example, Unity3D and various application builder, every one of which has specific advantage and disadvantage.
SetUp Android Studio
Before you can begin, you likewise need to install Java to utilize Android Studio. Particularly, you will require to install the Java Development Kit (JDK). Java is the programming language you will use to build your android applications and you have to install the JDK all together for Android Studio to have the capacity to translate and assemble your code.
Now launch Android Studio. When it opens up, you’ll be given a menu where you’ll have the capacity to begin or arrange a few alternatives. The immense thing is that everything is dealt with for you now, however you might need to acquaint yourself with the SDK Manager (Configure > SDK Manager) which is the place you’ll update your Android SDK to support newer versions.
Start New Project
The welcome screen demonstrates the present programming version and a couple of essential alternatives to get you started. Tap the featured choice to make another task.
In addition to making another project, you can open and import a current one, look at one from version control, and import an Android code test.
In the New Project window, round out the information boxes as you wish. Android projects take after Java conventions and keep source code composed as bundles. The main bundle standard name is important for different reasons. Three of them would be:
- The application primary package name recognizes it from different applications on the Google Play Store
- It’s related with your application that lives close by others on the Android gadget, takes into account proficient and secure correspondence between your own particular application segments and outside ones — for example, to exchange information between them is important to appropriately design your application by means of the Android Manifest.
- As a result of Android’s outline and adaptable setup conceivable outcomes, it’s present on an extensive variety of shape components and producer brands. leave the phone and tablet variant choice default, picking the Phone and Tablet variation with the Minimum SDK set to 15. As a result of this choice, your application will be perfect with each Android gadget with the operating system version 4.0.3 (Ice Cream Sandwich) or higher.
On the next page,you’ll be given the choice to pick the way you need your application to take a gander toward the begin. This will be the look of your ‘Activity Module’ which is essentially the principle page of your application.
Remember that an application can have numerous exercises that demonstration like separate pages on a site. You may have a ‘settings’ activity for example and a ‘main’ activity. So the activity isn’t the application per say yet rather one solitary page of your application.
For your first creation however, you’ll most likely do best to make something extremely simple that just shows a solitary, fundamental activity. Select ‘Basic Activity’ to keep things as basic as could be allowed and in every way that really matters, this will currently be your application. Click Next again you get the last few options. Now you have to pick the name for your activity and the layout name. The layout name describes a file that determines the layout of an activity.
This is a separate piece of code that keeps running working together with the Main activity code to characterize where components like pictures and menus go and what textual styles you’ll utilize. This is really not Java but rather XML – or Extensible Markup Language .
Your XML will work similar to HTML or a CSS template. The Java code for the activity in the mean time says what the components on the screen do when pressed etc. It’s fine to leave the default name here as ‘activity_main’. Now you will see the main Android Studio view with your main activity source file opened.
Write Some Code
It’s an ideal opportunity to look a bit at the code and write something. Practice together with a hypothesis is a standout amongst other methods for learning.
Return to the official Android site and this time go to Develop.Here you can discover there a considerable measure of supportive examples. Now run the application on emulator.
Here, you figured out how to design a crisp development of the Android Studio, setup an sample project, configure and run the emulator, roll out changes to source code and effectively run your application on the Android emulator.
For more options on android programming check out these Programming books for Android development