[GUIDE]Migrating from Eclipse to Android Studio

Search This thread

JoshieGeek

Senior Member
Nov 4, 2011
56
67

logo.JPG


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.
download-android-studio.JPG


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"
new-project.JPG


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.
FileSystem.JPG


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-text.JPG


Design with "Drag and Drop" mode
design-with-dnd.JPG


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.+"
}
android-support-v4.JPG


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


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.
run-conf.JPG


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..."
sign-apk-1.JPG


- 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.
new-keystore.JPG


- It will automatically completed our last dialog in keystore. Just click "Next"
sign-apk-2.JPG


- And "Finish"
generate-apk-finish.JPG


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:

aspellclark

Member
Sep 29, 2009
33
10
Bristol
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:

bassie1995

Senior Member
Jan 9, 2011
2,505
407
Delft
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

Senior Member
Nov 4, 2011
56
67
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...".

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?
 

JoshieGeek

Senior Member
Nov 4, 2011
56
67
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?

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

bassie1995

Senior Member
Jan 9, 2011
2,505
407
Delft
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

Senior Member
Apr 30, 2012
540
69
Could someone give me a little guidance?

i checked that path and there isnt even a config folder.
 

Attachments

  • Capture.PNG
    Capture.PNG
    101.5 KB · Views: 312

Garridon

Senior Member
Apr 30, 2012
540
69
Never mind, figured it out myself.

Has to make it run as administrator

Sent from my Galaxy Nexus
 
  • Like
Reactions: ceefour

JoshieGeek

Senior Member
Nov 4, 2011
56
67
That's why if I'm using windows 7 (or above), I will not install some development-related programs to C partition. But another, it will be much more flexible to edit and something like that. By the way, you do a good job to solve your problems by yourself. Experimenting the problems is a good way to learn.
:good:

Never mind, figured it out myself.

Has to make it run as administrator

Sent from my Galaxy Nexus
 
  • Like
Reactions: Garridon

ceefour

Member
May 22, 2013
5
1
40
Bandung
www.hendyirawan.com
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.+"
}

Thank you !

I think you mean "Android-AppCompat v7" not "Android-Support v7"

BTW when to use support-v4 vs appcompat-v7 ? What's the difference? Should I use both?
 

JoshieGeek

Senior Member
Nov 4, 2011
56
67
The difference is that appcompat-v7 will cover many more support libraries (for example: ActionBar compat). But your minimum version of App will be 7. So I recommend you to use appcompat-v7 than support-v4. Because there're not so many users that still using < v7.

From my experiences after I declare that dependencies, I got android support v4 and android v7. But still the minimum version MUST 7.

Have any questions? Feel free to ask me, I would be glad to help.

Thank you !

I think you mean "Android-AppCompat v7" not "Android-Support v7"

BTW when to use support-v4 vs appcompat-v7 ? What's the difference? Should I use both?
 
  • Like
Reactions: ceefour

ceefour

Member
May 22, 2013
5
1
40
Bandung
www.hendyirawan.com
The difference is that appcompat-v7 will cover many more support libraries (for example: ActionBar compat). But your minimum version of App will be 7. So I recommend you to use appcompat-v7 than support-v4. Because there're not so many users that still using < v7.

From my experiences after I declare that dependencies, I got android support v4 and android v7. But still the minimum version MUST 7.

Have any questions? Feel free to ask me, I would be glad to help.

Thanks Joshie! So appcompat-v7 it is...

So ActionBar is now provided by Google? So long Sherlock (it's still very nice though! yet I'm happy Google finally implements it too) :)
 

JoshieGeek

Senior Member
Nov 4, 2011
56
67
Yupz. And also implementation of Google's ActionBarCompat is very easy. So I prefer Google's to Sherlock..
But yeah, Sherlock is a good alternatives when Google has not even been releasing it.

Sent from my Nexus 4 using xda app-developers app
 

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
Yupz. And also implementation of Google's ActionBarCompat is very easy. So I prefer Google's to Sherlock..
But yeah, Sherlock is a good alternatives when Google has not even been releasing it.

Sent from my Nexus 4 using xda app-developers app

I switched to the Google one, too. However, there is this annoying bug: http://code.google.com/p/android/issues/detail?id=58321
And it does not provide a PreferenceActivity with the ActionBar.

Waiting for the next version... :D
 

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
  • Like
Reactions: JoshieGeek

laruku

Member
Sep 7, 2008
47
8
tech-barista.com
Starter choice : Eclipse or Android Studio?

Hi,

I'm currently an Enterprise Java developer and want to start building some apps in mobile space. As a new mobile developer, which one should I get start with now; Eclipse or Android Studio?

Regards
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 29

    logo.JPG


    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.
    download-android-studio.JPG


    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"
    new-project.JPG


    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.
    FileSystem.JPG


    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-text.JPG


    Design with "Drag and Drop" mode
    design-with-dnd.JPG


    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.+"
    }
    android-support-v4.JPG


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


    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.
    run-conf.JPG


    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..."
    sign-apk-1.JPG


    - 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.
    new-keystore.JPG


    - It will automatically completed our last dialog in keystore. Just click "Next"
    sign-apk-2.JPG


    - And "Finish"
    generate-apk-finish.JPG


    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.

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

    1
    Never mind, figured it out myself.

    Has to make it run as administrator

    Sent from my Galaxy Nexus
    1
    That's why if I'm using windows 7 (or above), I will not install some development-related programs to C partition. But another, it will be much more flexible to edit and something like that. By the way, you do a good job to solve your problems by yourself. Experimenting the problems is a good way to learn.
    :good:

    Never mind, figured it out myself.

    Has to make it run as administrator

    Sent from my Galaxy Nexus
    1
    The difference is that appcompat-v7 will cover many more support libraries (for example: ActionBar compat). But your minimum version of App will be 7. So I recommend you to use appcompat-v7 than support-v4. Because there're not so many users that still using < v7.

    From my experiences after I declare that dependencies, I got android support v4 and android v7. But still the minimum version MUST 7.

    Have any questions? Feel free to ask me, I would be glad to help.

    Thank you !

    I think you mean "Android-AppCompat v7" not "Android-Support v7"

    BTW when to use support-v4 vs appcompat-v7 ? What's the difference? Should I use both?