FORUMS

XDA Picks: Best Apps of the Week (July 25 – Aug 1)

Apps are at the front and center of any smartphone experience, and with over a … more

Voices Of XDA: Orbiting The Earth With Android

Editor’s note: This week’s feature has been written by forum … more

CloudPlayer: DIY HiFi Music Streaming Solution

In our Helpful Guide to Music Streaming Services, we mentioned several different services … more

Optimize Battery Life with This Useful App

Battery life is an important aspect of your smartphone, especially if you use it for more … more

[GUIDE]Migrating from Eclipse to Android Studio

56 posts
Thanks Meter: 66
 
Post Reply Subscribe to Thread Email Thread



On Google I/O 2013, Google has launched new IDE based on IntelliJ IDEA, called Android Studio. I'm really interested in Android Studio, given that I usually using Eclipse in developing Android application. I find that this IDE is really good (or should I say awesome!). But some of my friends said that they're having difficulties in using Android Studio, and prefer the 'good but old' Eclipse. Yes, Eclipse is good, but Google is more supporting the Android Studio. So with this articles, I want to share my experiences in migrating from Eclipse to Android Studio. I also included Google's official guide from d.android.com/

Let's start with pros and cons of Android Studio:

PROS:
- Better UI in designing and coding
- ProGuard and app-signing capabilities.
- Gradle-based build support (For you that has already get used to it)

CONS:
- Hard to manage multiple projects. (For example: to delete a project you have to delete from the explorer)
- Gradle-based build support (For you that's not get used to it)
- Still in EAP (Early Access Preview)

If you have something to say about PROS-&-CONS, I'm glad to hear from you.

Now move along to installing Android Studio. It's very easy.
First of all, go to http://developer.android.com/sdk/installing/studio.html and download the installer.


Windows:
- Launch the downloaded EXE file, android-studio-bundle-<version>.exe.
- Follow the setup wizard to install Android Studio.
- Known issue: On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location. Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21.

Mac OS X:
- Open the downloaded DMG file, android-studio-bundle-<version>.dmg.
- Drag and drop Android Studio into the Applications folder.
- Known issue: Depending on your security settings, when you attempt to open Android Studio, you might see a warning that says the package is damaged and should be moved to the trash. If this happens, go to System Preferences > Security & Privacy and under Allow applications downloaded from, select Anywhere. Then open Android Studio again.

Linux:
- Unpack the downloaded Tar file, android-studio-bundle-<version>.tgz, into an appropriate location for your applications.
- To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh.
- You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.

After you installed Android Studio, let your journey begin. But first, you must remember that Android Studio is still in EAP, so there will be many bugs/glitches/errors/whatever-you-call-it that can be annoying. But if you patient enough, you will find it very fun.

How to create project?
It's easy! Just use File -> New Project...
Or, if it's your first time using Android Studio, you will be welcomed with options to "Create New project"


Exploring your projects
File system is quite different with Eclipse. Considering that your android apps will be Gradle-based. So you just have to modify everything inside main project folder (See picture, file under "DMap" is main project folder). Unless you're an expert in Gradle and Intellij.


After you get used to the UI and layout, you can start coding & designing your app.

Designing Layout using Android Studio is Better?
Yes! You can see pictures below that you have 2 options to design layout. First by typing it directly through "Text" mode, or "Drag-and-drop" design. Both of them enable you to preview your design. Just have a 15-minutes experiments with your preview, and you will feel the power!
Let me give you some examples:

Design with "Text" mode


Design with "Drag and Drop" mode


How to include support library?
Another beautiful thing that announced in Google I/O 2013 is ActionBar Compat. I'm waiting it for a long time, because using "Sherlock ActionBar" is a little bit complicated. And now it's released. Download it with your SDK Manager.
Then include it in your project. How? Because this is Gradle-based, it's quite simple. Open "build.gradle" in your main project folder.

For Android-Support v4:
- It's automatically included when you created new project. But if not, use second step.
- Add this line:
Code:
dependencies {
    ...
    compile "com.android.support:support-v4:18.0.+"
}


For Android-Support v7:
- Add this line:
Code:
dependencies {
    ...
    compile "com.android.support:appcompat-v7:18.0.+"
}


How tot test your app?
Just like Eclipse, Android Studio support 2 way of testing. By using AVD (Android Virtual Devices) or by real devices. To edit configurations, go to "Run" -> "Edit Configurations". I recommend you to choose "Target Device" -> "Show chooser dialog", to give you more freedom in testing.


For AVD:
- You have to create at least one AVD. To create AVD, go to "Tools" -> "Android" -> "AVD Manager"
- In the chooser dialog, select AVD, and choose your devices.

For Real Device:
- You have to enable USB Debugging in your devices! Enable it, then go forward.
- Connect it through USB. In chooser dialog, you will see your device there.
Known issue: Sometimes the driver is not right. You should use Google USB Driver for testing app in Android. Or sometime, your device won't be detected if it's in sleep/locked mode.

How to generate a signed APK?
This is also easy! Android Studio is provided with App-signing capability so you don't have to open up your keytool or do somewhat-complicated task.
Here's some steps:
- Go to "Build" -> "Generate Signed APK..."
- Click "Create new..."


- To make a new keystore, just put a non-exist keystore in "Key store path:" (The folder MUST exist, while the file MUST NOT exist). And other details.


- It will automatically completed our last dialog in keystore. Just click "Next"


- And "Finish"


TIPS & TRICKS
If you want to change to Darcula Look and Feel, (in Windows) just press: "Ctrl + ~" -> "Switch Look and Feel" -> "Darcula".
This look and feel is very interesting, and I like it so much.

End of articles
It's easy doesn't it? There will be many improvements in the future that I don't know. But let's waiting for it. If you have any suggestions, questions, or even critics, just ask me. And also if you find it helpful, please click "Thanks" or "Donate". I will appreciate it very much.

Last edited by JoshieGeek; 21st August 2013 at 01:29 AM.
The Following 29 Users Say Thank You to JoshieGeek For This Useful Post: [ View ]
 
 
21st August 2013, 06:39 AM |#2  
JoshieGeek's Avatar
OP Member
Thanks Meter: 66
 
Donate to Me
More
Also check this official video from Google I/O 2013. About what's new in Android Studio

Last edited by JoshieGeek; 21st August 2013 at 06:47 AM. Reason: For fixed youtube videos
The Following 2 Users Say Thank You to JoshieGeek For This Useful Post: [ View ]
28th August 2013, 07:36 AM |#3  
aspellclark's Avatar
Member
Flag Bristol
Thanks Meter: 10
 
More
Multiple Projects
I currently have 8 active projects open in eclipse and during a single day I will work on at least 2-3 of them.

Does anyone know if android-studio will support this?

From what I have seen so far, it will only allow 1 project to be open at a time, this would mean have 4/5 android studios open at once just so that I can switch between projects.

Andy.

p.s. another question is : Can we use eclipse keystores for signing apps? if not what do we do about existing applications?
Last edited by aspellclark; 28th August 2013 at 07:43 AM.
28th August 2013, 08:13 AM |#4  
bassie1995's Avatar
Senior Member
Flag Delft
Thanks Meter: 419
 
Donate to Me
More
The thing that kept me off this was that it was impossible to correctly import an Eclipse project, when I tried it... I might give it a try by your instructions later.
28th August 2013, 09:55 AM |#5  
JoshieGeek's Avatar
OP Member
Thanks Meter: 66
 
Donate to Me
More
Hi Andy,

Android Studio will separate your projects into multiple windows. But not multiple instances. So don't worry it will not consume your memory excessively.

And based on my experiences, Java keystore will be saved as (.keystore) file. So yes, even though you're using Eclipse or Android Studio both of them are the same. Just locate your keystore file, and "Choose existing...".

Quote:
Originally Posted by aspellclark

I currently have 8 active projects open in eclipse and during a single day I will work on at least 2-3 of them.

Does anyone know if android-studio will support this?

From what I have seen so far, it will only allow 1 project to be open at a time, this would mean have 4/5 android studios open at once just so that I can switch between projects.

Andy.

p.s. another question is : Can we use eclipse keystores for signing apps? if not what do we do about existing applications?

28th August 2013, 09:58 AM |#6  
JoshieGeek's Avatar
OP Member
Thanks Meter: 66
 
Donate to Me
More
d.android.com has provided a useful solution for your problems, I think. Try this tips for export/import android projects from Eclipse to Android Studio. http://developer.android.com/sdk/ins...g/migrate.html

Quote:
Originally Posted by bassie1995

The thing that kept me off this was that it was impossible to correctly import an Eclipse project, when I tried it... I might give it a try by your instructions later.

28th August 2013, 11:11 AM |#7  
bassie1995's Avatar
Senior Member
Flag Delft
Thanks Meter: 419
 
Donate to Me
More
Quote:
Originally Posted by JoshieGeek

d.android.com has provided a useful solution for your problems, I think. Try this tips for export/import android projects from Eclipse to Android Studio. http://developer.android.com/sdk/ins...g/migrate.html

This way of working was not correctly working for me...
28th August 2013, 02:30 PM |#8  
JoshieGeek's Avatar
OP Member
Thanks Meter: 66
 
Donate to Me
More
Have you checked that you do it right? For example: Have you export it from Eclipse first, then import it from Android Studio? And not import it directly from Android Studio?

Or do you have any specific screenshot for logs / things that can give me some clues?

Quote:
Originally Posted by bassie1995

This way of working was not correctly working for me...

28th August 2013, 03:36 PM |#9  
bassie1995's Avatar
Senior Member
Flag Delft
Thanks Meter: 419
 
Donate to Me
More
Quote:
Originally Posted by JoshieGeek

Have you checked that you do it right? For example: Have you export it from Eclipse first, then import it from Android Studio? And not import it directly from Android Studio?

Or do you have any specific screenshot for logs / things that can give me some clues?

I followed the steps, but long ago. I'm going to try again soonish.

Sent from my GT-I9300 using Tapatalk 4
29th August 2013, 06:35 AM |#10  
Garridon's Avatar
Senior Member
Thanks Meter: 69
 
More
Could someone give me a little guidance?

i checked that path and there isnt even a config folder.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	297
Size:	101.5 KB
ID:	2220497  
29th August 2013, 07:27 AM |#11  
Garridon's Avatar
Senior Member
Thanks Meter: 69
 
More
Never mind, figured it out myself.

Has to make it run as administrator

Sent from my Galaxy Nexus
The Following User Says Thank You to Garridon For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread

Tags
android, android development, android studio, guide, tutorial
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes