Your First Android App

Once you have installed Android Studio you are ready to make your first Android app. Don't worry that you don't know much ye...


Once you have installed Android Studio you are ready to make your first Android app. Don't worry that you don't know much yet about the core Android concepts yet. This step is about getting Android Studio up and running, making an app and see it run on your Android phone or tablet. Once you have that, it is much easier to experiment with the various features of Android, because you can just make a small app (Android Studio project) to test it out, and run it on your phone to see how it works on a real device.

Starting Android Studio

First you need to start Android Studio. Find the Android Studio launch file (.exe on Windows) and start Android Studio. You will either have a shortcut in your Windows Start menu, on your desktop, or in the directory into which you installed Android Studio.

When you start Android Studio it may tell you that there are updates available for Android Studio. That is fine. Accept to download and install the updates so you have the latest version of Android Studio.

Creating a New Android Studio Project

If this is the first time you have opened Android Studio (or if you close an open project) you will be presented with this screen. Click on the "New Project" menu option in the right side of the dialog.

If you already have an Android project open, you can create a new project via the "File" menu at the top left corner of the open window. Choose "New Project...".

        

Application Name, Company Domain, Project Location

Inside the "new project" dialog you have to enter three values: Application name, Company Domain, and project location.

 
The application name is whatever name you would like your Android app to have. In this case just call it "My First Android App".

The company domain name is used to uniquely identify your app. Thus, even if two different companies create Android apps with the same name, you can still see which is which because their company domain names will be different. If you have a company, type in the company's domain name in reverse (e.g. com.company). If you have no company, you can just choose a fictive company domain name. To make this first app it doesn't matter so much. Only if you plan to release it to Google Play, then the company domain name matters.

The project location is a directory on your hard drive where you want to put all files related to this Android Studio project. I would recommend that you create an android-studio-projects directory in which you store all your Android Studio projects. Under that directory each project will have its own subdirectory. Thus, the project location for this first project could be:

D:\data\projects\android-studio-projects\MyFirstApplication
Once you have set the application name, company domain and project location, click on the "Next" button in the lower right corner of the dialog.

Selecting Form Factors


The second screen in the "New Project" dialog asks you to select what form factors your app will run on. Form factors means screen sizes and device types. Just select the "Phone and Tablet" option and leave the rest unselected. Then click the "Next" button.

              
Add An Activity

The third screen in the "New Project" dialog asks you to add an activity to your Android app. Activities are similar to windows in an desktop application. Thus, you have to choose what "window" or "screen" (activity) that your Android app will use. An Android app can use more than one activity (switching between "screens" / activities), but in this case just select "Blank Activity". Then click the "Next" button.

    
Choose Activity Options

The fourth screen in the "New Project" dialog asks you to choose option for your new file (activity). You have to choose an activity name, layout name and a title. The dialog has already suggested some names. Just leave these suggestions in the input fields and click the "Finish" button.

When you click the "Finish" button Android Studio takes a bit of time to create your new project. When it is finished it will open your new project in Android Studio.

  
Running the App

You are now ready to run your first Android app on your Android phone.

Enable Developer Options

First you need enable developer options on your device. The developer options enable you to connect the device to your computer via a USB cable, and run your apps directly on your phone via Android Studio. This is nice when testing out how your app works on a real phone.

Enabling developer options in Android 4.2 and later can be a bit tricky. The developer options are hidden. But, this short video explains how to enable developer options in Android 4.2 or later.

Install USB Drivers

If you are developing on Windows you may have to install some USB drivers for your device on your Windows computer. How that is done is explained in Android's guide to install USB drivers.

Plugin Your Device


Now plugin your Android device. Connect it to your computer with a USB cable. On the device, in the notifications bar it should say "connected as a media device". That is the right connection type.

After a short while the phone should show a dialog asking if you want to allow USB debugging on the phone. The dialog will show you the computer's RSA key plus some more information. Click the "OK" button. Now the device is connected to Android Studio. If you by accident click "Cancel" or click outside the dialog so it disappears, disconnect your Android device and re-connect it again. That should make the dialog show up again.

Run the App

In Android Studio's "Run" menu select " Run 'app' ".

After a short while Android Studio shows you a dialog where you can choose what device to run your Android app on. You should see your connected device in the list. Choose your device and click the "OK" button.


Look at your Android device. It should now be running a basic app with the title "My First Application" (or whatever name you gave it) and with the text "Hello world!" on the screen. This is the basic app that Android Studio created for you when you created the project. You are now ready to modify the project to turn the app into whatever app you want to develop.

You can also run your new Android app via the "Run" button in the toolbar. Here is where the "Run" button is located:

COMMENTS

Name

Android,9,Big Data,3,Cloud Apps,1,Database,1,Featured,12,Free Downloads,1,HowTo,1,IOT,7,Java,1,Linux,1,News,6,Products,1,SEO,1,TipsnTricks,5,Ubuntu,1,Unity3D,4,Windows Apps,1,
ltr
item
Tech Geek Bytes - A Blog For News, Tutorials, Free Source Code, Tips and Tricks: Your First Android App
Your First Android App
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEildBxNqLBuI2mM_b1dRcCfYvbi-dEfTnCE2loKrty4nADfYO4A22Mc1QmVKkZEOJsC4KgQDt5wqoWzzano6bWzHKgMJsBUbEGssP7ZCdhZBm7r9vEHM4rZreaXcue2Oq-vvTEDFyPM-zE/s640/ic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEildBxNqLBuI2mM_b1dRcCfYvbi-dEfTnCE2loKrty4nADfYO4A22Mc1QmVKkZEOJsC4KgQDt5wqoWzzano6bWzHKgMJsBUbEGssP7ZCdhZBm7r9vEHM4rZreaXcue2Oq-vvTEDFyPM-zE/s72-c/ic.png
Tech Geek Bytes - A Blog For News, Tutorials, Free Source Code, Tips and Tricks
https://techgeekbytes.blogspot.com/2017/06/your-first-android-app.html
https://techgeekbytes.blogspot.com/
https://techgeekbytes.blogspot.com/
https://techgeekbytes.blogspot.com/2017/06/your-first-android-app.html
true
8751912191394201619
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy