How to migrate entire Eclipse workspace to Android Studio? - android

I have an Eclipse workspace which contains 60 projects. 40 of the projects are Android library projects and some library projects uses other library projects. Relations between projects are very complicated however with eclipse's library system it was really easy to manage them. It seems Android Studio has is fairly complicated system when it comes to work with multiple projects.
Here is my main dilemma, should I create one big Android Studio project and port entire Eclipse workspace into it as modules or should I create new Android Studio projects for every single Eclipse Project.
IntelliJ explains that IntelliJ (AS) 'Project' is equivalent of Eclipse workspace, with this logic creating one big Android Studio project seems better option however I have read that doing things in Android Studio's way is to keep projects separated.
As you see I am really confused and I don't want to jump in work before convincing myself about the best solutiın. I have spent 2 days and haven't find a satisfying answer yet. Please share your ideas with me.

Well, it's possible to make a really HUGE project with several modules.
In my last job I had the project with modules like app for Tablet, app for smartphone, another app which takes similar resources and libraries and also has separated tablet and smartphone version.
If I were you I would import to Android Studio every made before in Eclipse library first, then make them ready to implement to your existing projects.
Next, if I had been imported libraries I would try to import every project of my 20 existing apps and add to its build.gradle these libraries.
Yes, it would be a lot of work to import as huge workspace to Android Studio, and might it seems to be easier to create one enourmous project than split it to several apps using existing libraries.
But like I said don't do one project with several modules. It would may cause in slow Gradle building, taking too much computer resources, changing one library may cause problem in some modules It's also harder to write automated tests or unit tests.
Do import libraries first and make them executable and then, finally import your existing apps and connect them with your libraries. I'm sure it would give you a profit in the nearest future

Related

Multiple APK inside Android Studio Like Eclipse

For some reason I can't find a clear cut answer to this. I am currently using Eclipse for my Android projects and as you can see from the screenshot my workspace has multiple APK projects, hundreds to be exact.
The reason for doing this is because it is easy to copy and reuse projects within the same workspace very quickly.
My question is, can this setup be done in Android Studio? I can't tell if it's one APK per Android Studio, or you can work with multiple in the same instance sharing dependencies like Eclipse did.
I am currently using Eclipse for my Android projects and as you can see from the screenshot my workspace has multiple APK projects, hundreds to be exact.
Been there, done that, found it to be unusable, except by keeping most of the projects closed, as it appears that you are doing based on your screenshot.
The reason for doing this is because it is easy to copy and reuse projects within the same workspace very quickly.
In Android Studio, you copy and reuse projects by coping the directory, using your development OS' file manager, the command line, or your favorite other file-management tool.
can this setup be done in Android Studio?
Not really. Android Studio supports a project having multiple modules, where those modules can be apps or libraries. There is certainly nothing stopping you from attempting to create a single Android Studio project consisting of hundreds of modules. However, they would all be the equivalent of open projects in Eclipse (actionbarsherlock and com.exposure.0 in your screenshot). I would expect Android Studio's performance to be worse than Eclipse's with hundreds of open projects, assuming that Android Studio did not flat-out crash due to running out of memory.
I was able to do it just fine without any issues. I was able to set two projects as Android projects in the settings.gradle file and just choose which one I want to launch. Hopefully over 300 of these doesn't start a performance issue. If it does I will just need to remove the modules and add the correct ones when exporting a new APK.
settings.gradle
include ':comexposure0', ':comexposure5', 'exposurelibrary'

How to replicate this in Android studio from Intellij?

Intellij has the option 'import module from existing resources'.
Android studio seemingly only has 'New module' or 'import module'.
Here is the result of both of these.
I much more prefer the Intellij way as it is way more organized, since it allows you to basically have multiple projects open at once. The Android Studio way does let you have them both open, but they are not treated as separate projects and or libraries, but instead as a different folder.
Is there any way to do this, or at least replicate it?
Right click on the project space and select New->Module and import from existing source. Find the path of your other project. When importing, you may rename the app files to "app2" or something. See if that's what you want.
Remember that Android Studio is built off of IntelliJ Idea, so a lot of the settings are similar. Personally, depending on my projects, I like to have several windows open for different projects since it gets crowded but I can understand why you'd want them in the same project space.

Android Studio vs. Eclipse: Which is Best [duplicate]

This question already has answers here:
Which Android IDE is better - Android Studio or Eclipse? [closed]
(5 answers)
Closed 7 years ago.
Google’s Android Studio is a development tool for Android based on the IntelliJ IDEA platform, one that managed to attract a lot of hype when it rolled out in mid-2013.
Eclipse, on the other hand, is the granddaddy of IDEs. although it support native Android support
which is the main differences in the Android Studio vs Eclipse battle?
which one is best for android devlopment
Go through https://www.airpair.com/android/android-studio-vs-eclipse
This might clerify your doubts.
Contents from site:
1 Before switching to Android Studio
I have written this guide to cover the basics of what you need to know before migrating your Eclipse projects over the Android Studio. If you have a large and gnarly project to migrate from Eclipse over to Android Studio, consider saving time by booking an hour or two with an AirPair expert who has done it before. Otherwise, read on!
2 Say Good-bye To Work Spaces And Sub-Projects
In Eclipse, you are probably familiar with the concept of a "Workspace." You likely even have an Android project currently which includes multiple component projects and libraries which are compiled into ".jar" files and included in the final resulting application. In Android Studio, projects are replaced with a new concept called "Modules" and "Library Modules."
3 Hello Modules
Modules are a "discrete unit of functionality that can be run, tested, and debugged independently" and are somewhat similar to an Eclipse project with a few key differences.
Each Module needs to have it's own Gradle build file(generally automatically generated for you when you create a new one, otherwise you can generate them if you are exporting a project from Eclipse). These Gradle files contain important details such as supported Android version ranges, dependencies and other meta-data about your Android project.
Just like in Eclipse, some Modules may be "Library Modules" which are conceptually the same as "Library projects."
4 Hello Improved Interface Designer
Android Studio features a new and improved interface design perspective where you can view the interface you are working on and its related components.Eclipse also has a similar design perspective so it shouldn't be too big of a shock for you. In Eclipse, a "perspective" is used for providing views and visible actions, as well as delivering mechanisms for interaction with resources, multi-tasking and information filtering.
5 Including Jar Dependencies
Like Eclipse, you will often need to link to JAR files created by 3rd parties. However, you will now need to get used to adding these .jar dependencies to your Gradle build file. Just like Eclipse, you will keep these .jar files in a "libs" folder at the root of your module (e.g. project) directory.
Simply "Right-Click" .jar files in your "libs" directory and select "Add As Library" and your selected JAR files will automatically be added as Gradle dependencies in the relevant build.gradle file for your Module. Make sure to always click "Sync Gradle" to ensure the project has been properly notified of the new dependency on these modules.
6 Adding Module Dependencies
Just like in Eclipse, one Module may depend on another Module. Follow these instructions to establish a dependency between two modules and Android Studio will automatically generate the necessary Gradle entries you will need.
7 Manifest Destiny
One major change you will need to get used to with Android Studio is that several common items and settings which once lived in the Android Manifest now are either automatically added (as in the case of the "debuggable=true" flag indicating an Android application may be debugged) or have been moved to build.gradle such as version codes and API min / max specifications. Feature and permission requirements, however, must still be declared in the Manifest as before (e.g. "permission: camera" and so on).
8 Get Help From An Android Expert
One thing that may be helpful is to enlist the help of a seasoned Android Studio expert to walk you through the nuances of the new IDE. Put in a request on AirPair to get paired with an expert - You will likely be surprised by how much ground you can cover in a short period of time talking to a real person.
9 Migrating From Android Studio
Read my guide on how to migrate from Android Studio to Eclipse to get specifics on the mechanics of exporting and importing an existing Eclipse project over to Android Studio. There are a number of potential issues that can occur along the way which I won't go into extensive detail on here.
10 Gradle Basics
The addition of Gradle is going to be your largest hurdle during your transition over to Android Studio.
11 Unit Testing
Android Studio comes complete with support for JUnit unit and Android tests, read more here. Setting up and running Unit Tests involves creating a few test classes and adding them to your project's run configuration. Follow the linked guide for more specifics. Popular testing frameworks such as Roboguice are not quite supported at this time but it wouldn't surprise me if they are in the near future.
12 Importing Remote Dependencies With Maven
Android Studio allows you to import remote library files from Maven Central. Browse Maven Central for remote libraries you might be interested in and follow these instructions to ensure these dependencies are automatically downloaded at compile time.

Android studio external library projects

I'm moving from Eclipse to android studio and this is my set up in eclipse:
I have several Android app projects, depending on several library projects (some shared) all within one workspace. In Android studio I first started creating a project per app, but quickly realized that I would have to have the library projects as modules within each project that uses them. This would mean duplicating the library projects and including them in each app, which is highly redundant and would require maintaining multiple copies of the libraries.
So I switched to having all my apps and libraries as modules within the same project. This works for building but creates other problems such as version control issues since each module lives in a separate version control repository.
What is the cleanest way to have this setup? And the real question is, can I have separate projects in AS that share the same external library projects?
NOTE
With the release of Android Studio 0.5.0, this answer is obsolete, but I'll leave it below for reference. For more up-to-date instructions, see How to share a single library source across multiple projects
In Android Studio, it's difficult to have shared library projects, because currently it's a limitation that all modules in a project must live under the same root folder; it seems like you found this out when you tried to solve your problem by making one big project that includes everything. We're working on trying to lift this limitation.
The best answer right now is to make the library modules separate projects and have them publish to a local Maven repository, and have the dependent projects pull them in from that repo. This means that you can't work on your app + library module sources from the context of a single project, unfortunately. A bigger disadvantage is that source attachments for those library modules doesn't work yet, so if you're trying to debug your app, you'll have difficulty stepping into code in the libraries.
I know this isn't a very great answer, but at this stage of Android Studio's evolution, it's probably the best we can do. We know yours is a fairly common use case, and it's a priority for us to support it.

Android AOSP project import into eclipse

So, this is not like other problems. I have basically one question
Android project build system uses the Android.mk files.
Is there any eclipse plugin out there that parses through the mk files and allows me to load those projects into eclipse ? essentially import Android.mk file project...
You can import the whole Android sources into eclipse. The instructions are here. Then you should make some modifications (for instance, include android-common_intermediates/javalib.jar instead of google-common_intermediates/javalib.jar) and you will have possibility to develop in eclipse.
Eclipse separates Android sources to several projects by itself(I think according to classpath entries). If you want to change this behavior you should look in this direction.
If you have tried eclipse instructions at Android source site, you probably would know by now that it leaves lot of details to imagination.
One thing you need to keep in mind is that AOSP build doesn't work with eclipse. As long as you build your code from terminal and use eclipse to edit/browse/debug purposes, you will have more productive sessions.
The article at Using Eclipse to browse/edit Android platform code explains this in step by step.

Categories

Resources