Beginning Android Development Part One: Installing Android Studio
- Introduction to Android Studio #1
Getting Started
- Download and install Android Studio.
- Set up testing for your app on devices and emulators.
- Create a simple “Hello World!” Android app that prints to your device’s or emulator’s screen.
- Import a sample project into Android Studio.
Installing Android Studio
java -version
. You should see some output that mentions a version number, like below.-bash: java: command not found
, or it could say No Java runtime present, requesting install.
and trigger a pop up that will lead you down the yellow brick road…to Oracle’s website.The Android SDK Manager
Installing a New SDK
Creating Your First Project
Identify Your Project
Choose an SDK
Set the Default Activity
activity
for your app.MapView
.- Activity Name: This gives your activity a name to refer to in code. A .java class will be created and will use the contents of this text field to give the class a name, which will ultimately be the name you use to refer to this activity in your code.
- Layout Name: You’re going to define your activity in Java, but the layout it shows to the user is defined in a special sort of Android XML. You’ll learn how to read and edit those files shortly.
Gradle is a relatively new build tool that’s easy to use, and if you investigate further, you’ll find it contains advanced options. It takes your Java code, XML layouts and the latest Android build tools to create the app package file, also known as an APK file.
Maven is another project build tool, and it can also refer to the Maven Central repository of java libraries.
Running on an Emulator
Creating an Emulator
Running on a Device
- Go to Settings on your device.
- Scroll all the way down and select About phone.
- Scroll to Build number and tap in multiple times. You’ll see a toast come up that states “You’re n steps away from becoming a developer”. Keep tapping and it will change to “You’re now a developer!” once it’s enabled.
- Go back to Settings screen and scroll all the way to the bottom. You’ll now see Developer Options enabled.
- Select Developer Options. Next, turn on the USB debugging switch under the Debugging section.
- Connect your device to your computer via USB.
- You’ll now be prompted to confirm this option via a dialog that states Allow USB debugging? — click OK.
- Next, you’ll be asked to register your computer’s RSA key fingerprint. If this is a trusted machine, then check the Always allow from this computer option.
Importing an Existing Project
- Download this project so you have a test subject.
- Once downloaded, unzip the contents and place them somewhere easy to get to.
- In Android Studio, go to File/New/Import Project….
- A window labeled Select Eclipse or Gradle Project will appear. Select the unzipped project from Step 1 and click OK.
- After Android Studio finishes importing, you’ll be dropped off on the screen below. Select the Project tab on the left panel as indicated in the screenshot below.
- If that’s not what you see,
- You’ll now see all the necessary files of the imported project in the project explorer.
No comments:
Post a Comment