-
Notifications
You must be signed in to change notification settings - Fork 24
Android_Getting Started
Before installing Android Studio and SDK Tools, you need to check the version of the JDK (Java Development Kit) installed on your machine. You can check the version by typing javac -version
in the command line. If the JDK is not available or the version is lower than 1.8, download the Java SE Development Kit 8 and install it.
Once the JDK installs, you should add the new system variable JAVA_HOME
that points to your JDK folder, for example C:\Program Files\Java\jdk1.8.0_77
.
Now you are ready to download and start installing the Android Studio. The installation is a simple wizard which installs the IDE and SDK tools at the same time, together with Android Virtual Device
which is a "preconfigured and optimized Android Virtual Device for app testing on the emulator". The default Android SDK
installation location is C:\Users\smuko\AppData\Local\Android\sdk
, while Android Studio
installs in C:\Program Files\Android\Android Studio
, however, once the Android Studio installs it will prompt you to install the SDK, which than alerts you that your path shouldn't have white spaces, so you should change it to something like C:\Android\android-sdk
.
During the installation of SDK components via Android Studio, I got the following error Unable to create a virtual device: Missing system image required for an AVD setup.
Open the Android Studio
and select the Create New Project
option.
Before you create a new project, you should decide what is the minimal Android SDK version that you want to support with your app. The lower version you select, the greater are the platform limitations due to its age, but you also cover more of the Android market share
. Android Studio
gives you the option to preview this Market Share
in percentage of devices that are running a specific version of Android, but you can also check it by following this [link] (http://developer.android.com/about/dashboards/index.html).
At the moment I'm writing this the greatest share percentage was owned by KitKat
, which is Android version 4.4
. Android Studio
has calculated that by selecting version 4.4
as the minimal SDK version for my project, that I would cover approximately 70.9% of the devices out there, but if I choose version 5.0
(also called Lollipop
) I would only cover 35.4% of devices. However, when making this decision you need to take into consideration the time it would take you to develop and release the application. Since I'm estimating that it will take me around 6 months to complete these projects at the pace I'm planning to take (~ 10 h/week), I'm guessing that the amount of devices running Android 5.0 and above will be closer to 60%, so I'm going to choose this version.
After you selected the desired Android SDK version, you are presented with an Add an Activity to Mobile
screen, which allows you to quickly build a base functionality for your application. There are various different activities you can choose:
- Basic
- Empty
- Fullscreen
- Google AdMob
- Google Maps
- Login
- Master/Detail Flow
- Navigation Drawer
- Scrolling
- Settings
- Tabbed
In my case I'm going to choose the Navigation Drawer Activity
, because I know that my app will require it, and this activity seems to me to be the most complicated one to implement manually, but I may be wrong here. You can see the initial state of the project and the Android Studio
once I completed the Create New Project
wizard.
Getting the initially created project to run on emulator should be pretty easy and straightforward, after all, the project was auto generated by Android Studio
, so let's see how it goes.
Inside the Android Studio
when you click on Run
button the studio will show you a list of available AVDs
(Android Virtual Devices, i.e. Emulators). If there isn't any available that supports the minimum Android SDK
value you selected when you created the project, you will have to create a new emulator. Creating a new emulator is pretty simple, just click on Create New Emulator
, select one of predefined devices, and select the Android version you want it to run. If the Android SDK version for AVD is not available on your machine, you need to quickly download it through the same wizard. Once the SDK downloads, finish creating the AVD
and then select it as a target for deployment.
Having setup the AVD
with the appropriate SDK version you would think that my initial hello world
project, built automatically by Android Studio
would be ready to be run on the emulator, however, you'd be wrong. For some reason, the Android Studio
set the targetSdkVersion
to N
, which is a latest version of Android that is still in preview at the moment. So now, when I build my project with gradle
, it sets both the minimumSdkVersion
and the targetSdkVersion
in Android Manifest
to N
, and, of course, my newly created emulator doesn't support this version so I'm getting the following error: minSdk != deviceSdk
I managed to fix this problem by changing the targetSDKVersion
and compileSdkVersion
to 23
and to android-23
respectively, in the build.gradle
script file. However, now I had to use the Android SDK Manager
to download the Android SDK versions 21 and 23 on my machine, as gradle
reported that they are not installed.
The reason why I used the version 23
for compile
and target
SDK was because I'm using the buildToolsVersion 23.0.3
by default, and the compile SDK version must match the support library's major version. Otherwise, my project wouldn't compile.
After completing the final step above I finally managed to successfully compile and deploy my hello world
app on my emulator, the result of this you can see below in the screenshot.
My loose estimate is that it took me around 3 hours to complete all the steps above, from installing the Android Studio and SDK, to running the app successfully on emulator. Not quite as easy and straightforward as you would expect, we'll see how Ionic will fair. I have to say the main disappointment was that the app wouldn't compile and deploy on my AVD
after Android Studio
generated it, and that I had to use google to figure out the issues and adjust the project's settings.
- Android
- Getting Started
- Project Structure
- Gradle
- Menu
- Theming
- Login Screen
- Menu & Navigation
- Importing Library From GitHub
- Creating Reusable Layouts
- Adding New Icons
- Profile Screen
- Chat Screen
- Contacts Screen
- Pending Invites Screen
- Settings Screen
- Add Library Dependency
- Discover Users Screen
- Splash Screen
- Auth0
- Authentication Logic
- Profile Screen Logic
- Send Feedback
- Authenticated to Firebase via Auth0
- Saving User Info to Firebase
- Storing User Connection Info to Firebase
- Calculating Distance Between Users
- Chat Logic
- Handling Device Rotation
- Android Other
- Ionic
- Getting Started
- Project Structure
- Menu
- Theming
- Login Screen
- Adding Images
- Creating Reusable Layouts
- Adding New Icons
- Profile Screen
- Contact Screen
- Elastic Textarea
- Chat Bubble
- Chat Screen
- Contacts Screen
- Pending Invites Screen
- Settings Screen
- Discover Users Screen
- Splash Screen
- Animations
- Auth0
- Storing User Data
- Profile Screen Logic
- Send Feedback
- Update to Ionic RC0
- Reimplemented Auth0 with Ionic RC0
- Authenticated to Firebase via Auth0
- Saving User Info to Firebase
- Storing User Connection Info to Firebase
- Calculating Distance Between Users
- Chat Logic
- Handling Device Rotation
- Ionic Other
- Version Updating
- Cordova
- Other
- Messaging