Introduction
This article will provide a walkthrough on setting up different Android Development environments of different Operating Systems. It will enable beginners to get a grip on how different environment are in different Operating Systems yet producing the same output as a result.
Background
I have made this article for different versions of android development environment setups in multiple VM images. This article will help you setup Android environment in Linux,MAC OS and Windows. As I had little knowledge about MAC OS I will also show the steps I took while setting up the environment as well as common errors faced creating the Android Developpment environment.
Comparison between Android Studio and Eclipse Android SDK
This is a detailed comparison of Android Studio and Eclipse
Android Studio
Android Studio is a new Android development platform developed by Google keeping future in mind. It's in Beta phase
Eclipse
Eclipse is the mother of all IDEs and it is well known development platform for android development. Google have developed the Android plugin for eclipse which is used predominantly.
Platform
References http://www.jetbrains.com/idea/
Android studio is based on IntelliJ IDEA which offers features and sets based on most modern technologies and frameworks for enterprise and web development.
Eclipse is based on Apache-ant which is one of the oldest software tool meant for Java development
Build System
For Android Studio it is Gradle
Gradle is build automation system evolved.Gradle combines the power and flexibilty of ANT with dependency management and conventions of MAVEN into a more effective way of build.
For Eclipse ADT the build system is ANT
Both Supports graphical layout
NDK support coming soon for Android Studio but it's there in Eclipse ADT
It means it is impossible to code in native languages such as C++ in Android Studio
Is there an alternate way?
here is the catch the issue is also resolved as per the latest finding as is well explained in IDZ video we can also code now in native language, there is an entire video showcasing how it can be done
- https://software.intel.com/en-us/videos/using-the-ndk-with-android-studio
- http://kvurd.github.io/blog/compiling-a-cpp-library-for-android-with-android-studio/
What's more as Android Studio is still in Beta phase there will be lot of updates until it gains its full functionality whereas Android Eclipse SDK is already a fully developed IDE so it is more stable as of now.Google have decided to make Android Studio to be the best IDE with all available frameworks for Android.
Creating an Android Development environment for MAC OS
You need to download Java for the Mac OS
Where to get it?
first of all check that you have java installed on your machine or not
Go to the terminal
As you launch the terminal check that if you have any java version installed using this command in the terminal
java -version
and then hit enter, if it is present it will show the version or if not present it ask for new installation
Click on More Info and it will take you to download link
When the download is complete,open up the downloaded dmg file via finder and then double click on it to get the installation started.The package on a new window will open up, double click the pkg file to complete installation.
after the installation is complete recheck on terminal window, the version of Java
java -version and then hit enter
it will show you the current installed version.
Installation of Android Studio
In google search type in Android Studio and it will take you to the download page, download the MAC version of Android Studio.
when the dmg file is downloaded. open it in finder
Double click on it for installation.
click on I don't have a previous version of Android Studio and hit ok.
After the setup is complete you will see that the android studio have started.
Click on Configure to see that the android SDK manager is available or not at my end it was greyed out, so I had figure out an alternate way and then thought of installing the eclipse ADT for Android to get it going.
At google search type in Eclipse Android SDK and the download link will appear.Start the download.After downloading is completed open the file in finder.
Now as my SDK Manager was greyed out I had to show the path of Android SDK to my Android Studio IDE. I Opened Android Studio clicked on configure clicked again on project defaults and then went to project structure and included the Android SDK path
Afre that I click on OK closed Android Studio restarted the Android Studio and saw my SDK Manager and was good to start with.As I am using VM I updated a lower version of android update(2.3.3) to get the AVD up and running
Then start installing the packages and accept the license.
and after that you will be up and running with Android SDK and Android Studio setup.
Creating an AVD in Android Studio
As I pulled up the SDK Manager in there at top i didn't find any tools AVD Manager options so I went other way round by creating a project and then creating the AVD.
Accept the default and then click next
required SDK to API 10 and then click next again
Check blank activity and click next.
As the project opens up click on AVD Manager
After that click on create
Put in AVD name, check the Device image you want to build the image for,target as API level 10 and select the skin and then click on ok.
Select the AVD and then Start it.
click on launch
The AVD will start.
Yahoo!! the AVD is up and running in Android Studio
Creating an AVD in Android Eclipse SDK
Open Eclipse from the folder and double click on the android eclipse icon
and it will ask you for workspace accept defaults
Create a new project
Accepted the api levels I made it 10 as I was using a VM
Then click on create an AVD icon to start the process
AVD creation done
Follow the same steps followed and you are up with the avd.
You are up and running with AVDs ..
Important Part setting JAVA_HOME
Issues that you could face while logging and working on terminal
Bash profile creation
Bash_profile is essential for working on command line in MAC OS.A normal install might not create a batch profile for you.I have had faced this issue and you will get something like this you need to checkthat you have Bash_profile or not.Put the following command on terminal to check it
open -a TextEdit ~/.bash_profile and hit enter if it is present it will show otherwise you will get this error.
In this case you will have to create a Bash_profile
the commands you need to put in terminal to create the Bash_profile
touch ~/.bash_profile and the hit enter
another command you need to put in the terminal
open -e ~/.bash_profile and then hit enter
It will open a bash_profile Window as shown below
In the bash_profile window you need to write these details line by line and then save it.
export JAVA_HOME=$ (/usr/libexec/java_home)
export JDK_HOME=$ (/usr/libexec/java_home)
Hit Command + s to save and then close it.
On the terminal window put this command
source ~/.bash_profile and hit enter it will load the environment.
Creating an Android development environment in Linux
Installation of Java
open a terminal in Linux
type in the command java -version and then hit enter.
It will show which version is there.
Check for the updates using the command
sudo yum install java and then enter
After that I faced an weird issue which can occur to any user the problem was user is not in the
sudoers file.The incidence would be reported.
We had to add the user to Sudo profile.
Had to try different ways
Getting to the vi editor and appended the file mohit ALL=(ALL)ALL
and I was good to go.
here mohit is the username
my issue was resolved.
Starting the Java installation
Get in to the JAVA Oracle website or type in Java install in Google to get the download link Download i586 32 bit rpm
Accept the terms and start downloading Save the file
Right click on downloads and open the containing folder
Now on the permissions tab you need to select the checkbox that says allow executing file as a program
Double click on the JDK version folder it will ask for install
In general installation starts but in my case I had this conflict error
Local file conflict between packages:-Two packages provide the sam file.This is usually due to mixing packages from different sources
so went back and uninstalled the conflicting version as I already had JRE by default
I used this command
rpm -e --noscripts jre-1.7.0_17-fcs.i586
and then hit enter and it removed the older version of JRE that was present.
and after a restart I was able to install java and it went through without errors.
type in Android Studio in google and it will show you the download link
It will ask for accepting the license just click on it.
As you click on it will shows the file to save
As the download completes you need to extract the file so extract the file to tmp
extract to temp
extraction starts
Now go to the file system
go to the tmp folder where the android studio was extracted.
get into the bin folder
right click on studio.h file and open it
then click on run in terminal
then for the time importing your settings you need to click on previous version of Android Studio and click ok
Then you will get the main interface for Andoid-Studio
We need to click on SDK Manager
Click on tools
Click on Manage AVDs
Then click on create
updating the android api version I am putting it lower one as i will be creating the AVD in VM.
Accept the license and then click on Tools and then Manage AVDs and then click on create a new one
put in the details for creating the AVD
When the AVD is created click on ok
After creation of AVD click on Start
And you are good to go.
Creating an Android dev environment on Windows OS
Installing Java
In google search engine you need to type in Java download
download it from the oracle.com website Java link
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Double clicking the installation file starts installing the Java files
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
download the windows x86 package
After installing we need to configure the environment specifically create JAVA_HOME
Right click on My Computer(this pc) and then go to the properties option
Click on advanced system settings
Then go to environment variables
Set the path for JAVA_HOME give the entire path till bin
Installing Android Studio
At Google search type in Android Studio and it will take it to the download link
https://developer.android.com/sdk/installing/studio.html
Accept the license and start installation
Click on next as per the process installation happens and the IDE is installed.
After installation click on new project
and then click on configure
then click on sdk manager
update the android SDK Manager with API level 10(2.3.3)
Click on tools and then click on manage AVDS
Click on create and then setup your AVD names etc
hit ok and then select the AVD and then click on start and hit launch
The AVD will be up and running
Creating an AVD in Eclipse
At google search we need to type in android sdk it will take you to the download page
http://developer.android.com/sdk/index.html
Accept the license terms and download the 32 bit version of Android ADT go to the folder where it is downloaded
Double click on SDK Manager and then update the API version needed to create the AVD and then click on tools and then manage AVDs same as before create a new one
AVD will be up and running
After all our efforts we managed to create AVDs in three different OS(MAC,Linux and Windows) and it has helped us know more about how we go about creating the development environment in different Operatin Systems .We came across certain issues which were unknown and resolved it.
Tips and Best practices
Try to test as much as possible before taking the app live to store.Make sure you go through all the steps mentioned on creating the development environments as each platform has its own issues and ways of resolving them.Try developing more native apps in Android Studio. If you want your emulator to run faster try using geny motion(it is a third party emulator which is much faster than default emulator which that is present in Android studio).Download link :-https://cloud.genymotion.com/page/doc/#collapse4
If you want to accelerate the VM using native Android Studio you will require Intel HAXM package.
Intel has come up with new IDE which has all the capacities built together in a common platform where in you can bind different things together to the interface
It comprises of latest C++ compiler and different modules such as Threading,Media etc.
You can also customize the setup for different platforms as shown below
References
Points of Interest
It's been a great time setting up developer environment for different platforms as I came know how I would go about installing Android SDK on different platforms and what are th common issues one would face.
History
The first version of the article is ready