Android project as library to another project on github - android

Now I have two projects one is like model and another is like view. Now I use it in eclipse and model is used as library for view. But now I need to move this projects on Github. But I don't want every time to checkout both projects. Is there any way how to do it easily?

Easy but wrong
Most Android library projects which contain a Library and a Sample project have done the following:
Put them both in a empty folder (eg. your workspace)
Call git init in that folder, normally this is called within the project itself.
The right way
As indicated by the titles, the method above is not the normal way,
You should take a look at Submodules,
which is the standard procedure for having multiple projects with git

Related

Multiple android app projects sharing code in Clean-Architecture

I want to create three related android apps (employee, Manager, Secretary) in clean-architecture and also share common classes (utils, Ui & etc.) among all three apps in order to reduce code duplication. Each project has multi-modular clean-architecture design. Would you guide me on how to connect these three projects to the shared classes, please? Is there any sample code for my case?
My project after using clean-architecture book by Alexandru Dumbravan:
I think you might do some separation code between apps. You can merge it in you settings.gradle to merge all apps/libraries in one project.
Here is the example
There is 4 additional code/library in 1 project which is app, xxxapi,xxxauth and xxxcommon.
So you can set your settings.gradle into something like :
include ':app', ':xxxapi', ':xxxauth', ':xxxcommon'
If you already set that code, you can use it in all your code in one project as well.

How to create Android custom view library in Android Studio?

I've created a custom view that extends a RelativeLayout for a project I'm working on. I think it might be useful to others, so I've been trying to set it up as a library so others can find and use it.
I've haven't been able to find a clear answer on how to go about setting this up in Android Studio.
To be clear - I have already built the view and it is working fine, I just want to package it up as a library.
Do I create a new project and simply put my code there, or do I need to make a new module too? Once I do either of those things, which parts of the manifest and gradle files do I need to change?
Lastly, do I need to somehow get an AAR from the files or is it best to just upload it to GitHub and let others clone it?
In Android Studio (v 1.0.2):
File -> New module... -> Android Library
In this new module put all the code you want to share. Android Studio should update Gradle's settings accordingly.
You can publish your library as source code and/or artifacts in some Maven/Gradle repository. Publishing source code allow others to contribute to your work, fixing bugs or extending functionality. However, if you just do that, it won't be very convenient to reuse it for other developers, because working with source requires checkout and build. If you publish also artifacts (in some Maven/Gradle repository) built from that code, you will simplify the life of people using your code :)

Modifying SubModules

I have a project I am working on. I use a library that is on GitHub. Normally I have been using this library via Maven. However there are some bugs in the library so I would like to include this library in my repo so I can modify it. I then build the library myself.
What is the best strategy for this? I have tried using sub modules, however this explains that it is not possible to modify the library in this way.
Since you are wanting to make your own changes to the library, create a copy of the repository (fork) to make your changes in. This way, your changes can be committed, pushed to the server and if warranted, shared with the original repository.
Bring this new repository into your project the same way you have been for the original.

Version controlling Android/Eclipse project with all it's 3rd party libraries

So here is the deal. Let's say I'm developing an app depending on the Facebook SDK and Chris Banes PullToRefreshListView. I import the SDK's to my workspace(which I don't really like since it fills upp the workspace!) and reference it in my app as libraries. I'm making some changes to the PullToRefreshListView, let's say I'm adding a custom font or changing the color of one of the labels.
Now, I'm using Git to version control my project. I would like to be able to put up my project to our Git server and make my colleagues able to pull the project and get to work without having to struggle with getting the same SDK's (of the same versions as I used) setup and referenced in the project. Since I've made some changes to one of the libraries, the project could never be fully restored by another person if I don't provide the code.
How should I act in this situation?
Is it possible to put an uncompiled library in the libs folder or something like that?
If not, what is the right way of accomplishing this?
All I can find when Googling or searching Stack Overflow is how-to's on using compiled .jar files in the libs folder, which is good but not what I'm looking for.
Essentially, I'm looking for a good way of structuring projects using 3rd party libraries.
It sounds like these are android library projects (they contain assets). If that's the case, you can't turn them into JAR files.
The easiest way that comes to mind is to have your root project folder contain your app and all said libraries:
Root
-\Your app
-\src
-\res
-\3rd party lib 1
-\3rd party lib 2
-\3rd party lib 3
This structure would make it pretty simple to push to git and manage in eclipse.

proper git branch for an Eclipse Android codebase

I have an Android project in Eclipse which I've used git for revision control. The project is built around an sqlite database and I've named the project com.lsp.rengine.
I now want to create a second application using a different set of data. I can basically copy the new database over the top of the existing one (in assets/) and things work fine. I will need to change some icons and layouts however, so thought a simple git branch would get me on my merry way.
There are a few show stoppers which are stumping me. For one, I can't install both applications on the same device as they currently share the same com.lsp.rengine name. If I refactor the project name to com.lsp.pengine, my upstream branch thinks all the shared code has disappeared.
How can I manage Eclipse, the two branches in git, and still have shared codebase (update master codebase, changes are reflected in both branches) and somehow have two separate install locations?
I think the best approach would be to refactor your code into two separate Android projects with a third library project containing all the shared code. The TicTacToeMain and TicTacToeLib sample projects should be able to help you get started.

Categories

Resources