Android Studio transition and using sub libraries / sharing libraries - android

I am trying to transition all our projects from Eclipse to Android Studio (Finally decided i had to do it..!) but i am fighting seriously with the way how Android Studio / gradle works - in regard to using external library projects.
Until now in Eclipse - we used to have all the dependent projects in the same workspace and they where 'shared' amongst all projects which were under development.
That made it extremely nice to do changes on the external changes and commit them separately to their own SVN repos - while the projects using them - to take advantage of the changes without thinking.
That goes specifically to one library - our own framework which we use for all android projects and it is constantly being developed, altered, partially reworked and used by several people.
But then came Android Studio... the problem is that say if i have an example project with 10 sublibrary dependencies, including our framework - Android Studio with physically COPY all files into a subfolder of the main root project - loosing all the capabilities to 'commit' changes later being done to the sub libraries - to their own SVN repos.
I've tried pretty much everything, i think i've read everything :) but crap - nothing seems to 'fix' my work case..
I tried to checkout one sublibrary in the already checked out root folder of the root project and tried to import it into it - but ofcourse Android Studio says 'library already exists' - so that doesn't work. Even if it did... the library itself has its own deps and what i saw is that Android Studio will decouple them upon import and put them at the same level in the root project.. which completely messes everything up.
So my question is - even if i understand this is no longer possible - is there any EASY way i can at least COMMIT BACK to the SVN repo of the sublibrary from within the root owning project - using Android Studio (by easy i mean from the UI directly without needing to mess with manual console merge hazzle...)
I can't understand how anyone has not solved this yet - i am sure everyone is doing this one way or another?
Could someone share a good practice way of 'doing' it? :)
THANK YOU!

What i did:
Switched to: git
Converted our subprojects to git from svn
Made all subprojects externals of the primary project
Included the subprojects in gradle with the help of this post: Android Studio 0.8.1 Creating Modules without copying files?
Cons:
Not fully manageable from Android Studio - have to do half commits in Studio, the other half + pushes in console - so i ditched Studio completely and moved all to console once again. May be this ain't so bad after all :)
What i did was use Blundell's advice - although i really... really ... REALLY didn't want to go switching completely to git...
We have over 300 repos here in SVN and it's really not the time to start the git hazzle...
But this was the only workable solution so far as git externals make it really really easy to work in such way.
The f**** up thing about this is that half work has to go to console again... Externals and adding git remotes can't be managed from Android Studio... Life, i guess :)

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'

Building a Github library project locally in Android Studio 2

Like many a newbie I've been blindly clicking away in Android Studio 2 stumbling my way through building an app. Most of it just works so I've not really got my head into gradle.
Any road up, I've wanted to link into Strava and discovered that there were a couple of guys who had done the heavy lifting but on using a specific project, at the vital point of getting the data there is a coding problem. I thought the best approach would be to solve the problem and feedback.
So I downloaded the GitHub project in a zip and tried to do a standalone build and then things just didn't work. I think the basic problem is a) I don't know what I'm doing, and b) presumably the build on GitHub was done using different tools that are not set up for Android Studio.
So given that there is a working project on GitHub (specifically https://github.com/SweetzpotAS/StravaZpot-Android ) what are the dummy steps for getting that project to build locally in AS 2?
The problems I had are that on trying to open the project picking up the gradle file (couldn't find anything else to open in the root directory, the build didn't want to work - complaints about mixed projects. I stripped out the testing app and just tried to build the lib, but I didn't get a working lib in the output directory, just 2 25k stub aar files. Ideally I want to have that as a standalone project to build a local lib and then use that lib in my project (which I reckon is within my abilities!). Run out of Google search ideas!

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 open source project fork – missing references

I want to fork an Android project (a normal application) from the official repository. After I clone the project and import it into Eclipse, I still have loads of different missing references to some other projects that prevent me from even looking at the layout ressources (as it tells me to fix the Java errors first).
Is there a way to fix those references, without using repo or cloning the whole repository (with all its projects)? After all I’m only interested in a single standard application there.
If it is using anything that is not the official SDK, you'll have to fetch it to get it compile. You can import in Eclipse if you have the whole thing.
BTW, cloning the whole repository is worthed, because you can grep to search for things, even if you don't intend to compile it.
For changing an App that is based on the whole Android repo, you really have to have the whole repo with you. Then you can just change that App and make that App, for example using "make Email". That will only build the Email.apk and not the whole ROM.

Another Eclipse/Android/version control system question

I saw the question in this post and I have a similar but perhaps more detailed question. I have just installed SVN and Subversive and I added an existing project to a repository. Then I checked out the project and opened it. Unfortunately, in Eclipse, the Subversive layout has taken over the Android layout in the Project Explorer view and I'm not too happy about that.
In other words, the Android layout organizes the project under src, gen, assests, res, and other nodes, whereas the Subversive layout organizes the project strictly by the folder structure under the repository. Is there any way to use a source control plug-in AND keep the Android layout? If not, I may just resort to removing the Eclipse version control plug-in and manually use TortoiseSVN.
I remember having a similar issue with my team.
we thought that having the eclipse plug in would be a great idea (handling everything from the same app) but we got lots of problems with the layout and the conflict resolution.
my advice is to keep editing in eclipse(neat beans or whatever IDE) and use tortoise in your explorer to commit, and when you update hit F5 and continue coding ^^

Categories

Resources