Android Git: Making one project and doing changes - android

I am working on an android project that have later to be translated to many other languages and some changes have to do in design.
Now I want to know is there any way to make one project and keep it on git and later having changes should change the git project accordingly. So is it possible to create multiple apps for Android project. If yes, is it possible with Eclipse and git or someone has any other idea?
For the time being I am saving project in local directory and copy that project to make changes for next app.

This sounds that you should give git-subtrees a try. There, you create one repo with your base project and then import this repo into your specific app project. If you want to propagate your changes to the API, you push the changes to the base repo. We use this for component development.
But from my experience: do not use eclipse for working with git. It has some major drawbacks and might corrupt the repos. Use the CLI or another tool.

Related

Change name of Android project on Github

I have a single Github repo that contains 5 Android projects. Say one of the projects is named ToysGift and I want to change that project name to ToyDrive. How do I do that?
I am using Android Studio. Can I just change the name of the project in Android Studio and then push to Github? Git always proves challenging for me that's why I am asking first before trying different things because once I break what I have, I won't know how to get back to a good git state.
Did a quick test, Just changing the project name in android studio and then pushing should work, just make sure you have everything pulled so there aren't any conflicts.

Is there a way to build a signed APK in Android Studio without the uncommitted changes I've made?

I use SVN in Android Studio which tracks the changes I've made compared to the committed copy. Today, I wanted to build an APK for QA without incorporating the changes I've made to some classes that I hadn't committed yet to SVN. Is there a way to make an APK that would ignore the changes or do I have to comment each of the lines I've added/changed out (which is what I did today but seems like there would be a better solution)?
Edit: I forgot to include that I was looking for a way without having to create a separate branch. Vampire's solution is perfect.
Android Studio is just a specialised IntelliJ IDEA, so you can use its Shelve Changes functionality. Go to the Version Control tool window in AS, right click the changelist and select Shelve Changes.... Then do your build without your local changes and unshelve the changes afterwards.

Backup of Project in Android Studio

We all know that How much the Backup of the project is vital in the programming, when specially you are making a major changes in your code to experiment something new. But eventually you came across to fact that last changes that you have made earlier were correct. Or sometimes you just messed up your whole project. So there must be Backup of project for that.
So Do you know a way to take a local backup into other location of your machine as we know mySql , Visual studio do. I know only a single way and that is to just copy the project from project explorer and and past it some where else.
Do you know any other way of taking such type of back up. (I do not want to take back up over the internet. Thanks)
Android studio is powered by Intellij and it has inbuilt support for Local History.
Local History, which is your personal real-time version control
system. Local History is independent of external version control
systems and works with the directories of your project even when they
are not under any VCS control.
Local history is cleared when you install a new version of IntelliJ
IDEA or when you invalidate caches. Therefore, check in the changes to
your version control system before performing these operations.
Source - official IntlliJ documentation
Detailed description of Local Hostory feature here
Local History is independent of external version control systems and
works with the directories of your project even when they are not
under any VCS control. It applies to any structural artifacts: a
project, a directory or package, a file, a class, class members, tags,
or selected fragment of text.
Unlike usual version control systems, Local History is intended for
your personal use, it does not support shared access.
With Local History, IntelliJ IDEA automatically tracks changes you
make to the source code, results of refactoring, and state of the
source code based on a set of predefined events (testing, deployment,
commit or update).
Local History revisions are marked with labels, which are similar to
versions in traditional version control systems. Labels based on
predefined events are added to the local revisions automatically;
besides that, you can put your own labels to the project artifacts to
mark your changes. Reverting or viewing differences are performed
against these labels.
As showed in the comments, you can use git local. Once started git in your repository you can make all the changes and commits, create branches, tags and everything useful to control the versions of your application.
More info see: Git Basics - Getting a Git Repository
One way how you can take backup of all the code is using GIT as mentioned above,
in one more answer, I found these steps very useful -
it will generate a zip file of the project resources -
git init # on the root of the project folder
git add . # note: android studio already created .gitignore
git commit -m 'ready to zip sources'
git archive HEAD --format=zip > d:/archive.zip
Note: If you intend to send this by email, you have to remove gradlew.bat from zip file.
Reference answer
From experience, GitHub has been the best option. But remember, saving code only is not the safest way. Never forget your Keystore!!! Without it, you can never update a package on the store, you will lose all billing licenses and Firebase tools...the list is endless.
In short, GitHub your code, and manually back up that keystore file.

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.

Surround SCM integration with Eclipse for Android project

I have a bunch of code in Surround SCM, which I would like to get into a workspace in Eclipse. I will need to be able to work off of two branches. One for bug fixes, and one for new features, which can then be merged into my main branch. What is the best way to do this?
Disclaimer: I work for Seapine but I wasn't involved with anything to do with Eclipse.
What we do here internally is have a separate Java project for each branch in a single Eclipse workspace. To do so create a workspace somewhere and do:
File->New Project...->Java Project
This brings up the new project dialog. You can then point the project at the existing source path for the first branch, in my case the mainline branch, using the "Create project existing source" radio. I think I might have an older version of Eclipse installed but it should be the same or similar in new ones.
Clicking Next will take you to the next screen.
Here you can set up specific settings for this branch, like packages to exclude or things like that.
Click Finish and your project will be set up. Just repeat the same steps for a different branch using a different disk location.
Once you make changes to your branch code you can just check it into Surround SCM, promote it to the mainline, then do a get bring down the changes locally to your other directory.

Categories

Resources