Module linked android studio projects sharing drawbles? - android

I've linked two different android studio projects into one app using the modules. Some of the drawables from both projects are named the same (there is too many to change the names manually), is there a way to make it so one project doesn't use the others drawables? Maybe something in gradle?
I can't figure it out.

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.

How to migrate entire Eclipse workspace to Android Studio?

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

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.

Purpose and Disadvantages of an Android Library Project

At the moment I have two versions of my App: normal and plus
When I puplish a new relese I export it and then change the packet name and export it a second time. The plus version has some additional features which get unlocked by the package name..
I just discovered Android Library Projects (http://bit.ly/voHVWe) and now I wonder if that could be solution for optimizing the workflow decribed above?
A further question is, are there any more (dis-)advantages of using library projects?
- or would you propose another workflow?
Library projects can help you do exactly what you're looking to do. They're essentially like having an external assembly. All shared code would be in the library project, and each application (in your case, normal and plus) could utilize or inherit from the shared library code.
One gotcha for the library projects is that you need to make sure the application projects are using the latest version of the library project if you make any changes to it. I've been bitten before when I made a change to a lib project, and built the application to find out that it was using the old code (in eclipse just select the greyed out project, right-click and refresh).
This is the preferred way of developing apps with common resources and source code. There are some considerations to be made that are covered in the Managing Projects Developer Guide article.

Categories

Resources