5,597,354 Members 33,138 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE]Migrating from Eclipse to Android Studio

Tip us?
 
JoshieGeek
Old
(Last edited by JoshieGeek; 21st August 2013 at 01:29 AM.)
#1  
JoshieGeek's Avatar
Recognized Contributor - OP
Thanks Meter 64
Posts: 56
Join Date: Nov 2011

 
DONATE TO ME
Info 2 [GUIDE]Migrating from Eclipse to Android Studio




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.



to boldly go, where no one has gone before!
The Following 28 Users Say Thank You to JoshieGeek For This Useful Post: [ Click to Expand ]
 
JoshieGeek
Old
(Last edited by JoshieGeek; 21st August 2013 at 06:47 AM.) Reason: For fixed youtube videos
#2  
JoshieGeek's Avatar
Recognized Contributor - OP
Thanks Meter 64
Posts: 56
Join Date: Nov 2011

 
DONATE TO ME
Also check this official video from Google I/O 2013. About what's new in Android Studio



to boldly go, where no one has gone before!
The Following 2 Users Say Thank You to JoshieGeek For This Useful Post: [ Click to Expand ]
 
aspellclark
Old
(Last edited by aspellclark; 28th August 2013 at 07:43 AM.)
#3  
aspellclark's Avatar
Junior Member
Thanks Meter 10
Posts: 29
Join Date: Sep 2009
Location: Bristol
Default 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?
 
bassie1995
Old
#4  
bassie1995's Avatar
Senior Member
Thanks Meter 396
Posts: 2,381
Join Date: Jan 2011
Location: Delft

 
DONATE TO ME
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.
 
JoshieGeek
Old
#5  
JoshieGeek's Avatar
Recognized Contributor - OP
Thanks Meter 64
Posts: 56
Join Date: Nov 2011

 
DONATE TO ME
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 View Post
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?


to boldly go, where no one has gone before!
 
JoshieGeek
Old
#6  
JoshieGeek's Avatar
Recognized Contributor - OP
Thanks Meter 64
Posts: 56
Join Date: Nov 2011

 
DONATE TO ME
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 View Post
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.


to boldly go, where no one has gone before!
 
bassie1995
Old
#7  
bassie1995's Avatar
Senior Member
Thanks Meter 396
Posts: 2,381
Join Date: Jan 2011
Location: Delft

 
DONATE TO ME
Quote:
Originally Posted by JoshieGeek View Post
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...
 
JoshieGeek
Old
#8  
JoshieGeek's Avatar
Recognized Contributor - OP
Thanks Meter 64
Posts: 56
Join Date: Nov 2011

 
DONATE TO ME
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 View Post
This way of working was not correctly working for me...


to boldly go, where no one has gone before!
 
bassie1995
Old
#9  
bassie1995's Avatar
Senior Member
Thanks Meter 396
Posts: 2,381
Join Date: Jan 2011
Location: Delft

 
DONATE TO ME
Quote:
Originally Posted by JoshieGeek View Post
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
 
Garridon
Old
#10  
Garridon's Avatar
Senior Member
Thanks Meter 67
Posts: 452
Join Date: Apr 2012
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:	233
Size:	101.5 KB
ID:	2220497  

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

Advanced Search
Display Modes