Backup of Project in Android Studio - android

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.

Related

How to backup an AOSP project on GitHub

I have an Android project composed of AOSP, and other code in an Ubuntu environment. As you know, I used git and its associated tool repo to download AOSP according to the procedures on android source site. Now I want to have a way of controlling the changes I make to the environment. I have read about Git, but perhaps not enough to know what is the best way to do this. Maybe I already have this capability just by using Git locally? So my question is: What is the best way to save state in my build environment please, and how do I save this on Github as a remote backup repository? I believe I need to have a .gitignor file to exclude object files? Basically I have a WORKING_DIRECTORY with all of my code in there. That directory has a .repo and .git directory in it.
You will find that most or all of your changes will be under certain branches. For me, I develop roms for the Nexus 9 so a lot of my changes are under device/htc/flounder. The common branch is frameworks/base/ where I also make a lot of changes.
To this end I have two separate git repos that store these:
https://github.com/seanashmore/frameworks_base
https://github.com/seanashmore/device_htc_flounder
To create these, I created a github account. Then went to each of he top level folders i.e. frameworks/base and device/htc/flounder and ran the command 'git init'. This initializes those directories as git repositories. You also need to create the repos on your github account, this will give you url's for you to 'push' your code to.
The initial push of frameworks/base will take some time as it is quite large, but once you have done that first push its very handy to keep track of your code changes and all the other benefits that git brings.
A very handy git guide can be found here: http://rogerdudler.github.io/git-guide/
If you need any more information or help just ask.

xCode build how to determine git branch?

Suppose i'm working on a regular xCode project that has git tracking the files.
For internal usage purposes, i'd like to know (by looking inside at the iOS app running on the iphone) certain debugging information, such as what git branch the developer was on.
how could this be done?
on Android, you can modify the build script to look at the person's .git directory from where they've built and see something like refs/heads/feature_branch_2 inside the /.git/HEAD file.
on xCode i have no idea what tool is even being used to build, let alone modify the build script. or... do i have to modify the build script? (i.e. is there an easier way?)
You can manage it via source tree MAC application and change gitignore path for manage conflict.
You can change gitignore path - SourceTree->Preferences->Git->Global Ignore List->Edit File.
You can manage various commits and all the thing via its GUI.

Android Git: Making one project and doing changes

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.

Most rational and painless way to work on the same Eclipse Android project on two different PCs

I have a project that I develop partly at the work pc and party at my home PC.
Export-Import-Export-IMport and so on
And every day I spend a good amount of my time trying to resolve those annoying build path and configuration issues. Today I have written two lines of code and I have wasted the rest of my time dealing with all kinds of errors you could imagine.
And this hell repeats daily.
So I thought
Could I install Eslipse ADT on a flash drive and have my workspace on the flashdrive as well, so once the configuration is set up properly, I will be able to finally concentrate on development?
I could equalize the number of drives of both my PCs so the flash drive always appears as with same drive letter, if that could be an issue?
I really want to find a way to use the same IDE installation and the same workspace at two computers. Not two different IDE's.
Every time my project needs a new library I have to install it on both computers and it goes to a different directory and then I have to set the project to use it and when I switch computers all settings are wrong again.
This happens to me aswell. Your problem is that Android uses some external libraries, which on every computer, are located on a different directory.
Those libraries, are referenced in a file named project.properties.
All you've to do, is use a GIT or a SVN as a link to your home - work. And then, add several ignores, basically:
project.properties
bin
gen
This will kill any troubles.
In Eclipse, the project contents and the workspace are logically separate (although the default location when creating a project is place its contents in the workspace folder on disk, it doesn't have to be that way). Workspaces can not be shared between computers or users, but project contents should be. That includes all of the configuration files that make up a project (.project, .classpath, etc).
You could use a portable storage location like a flash drive or Dropbox to store just the project contents, and import it into each different Eclipse workspace you want to work on it in (ie, each different computer), but you'll need to always remember to Refresh the entire project every time you start to work in the workspace and there's a potential for human error to screw things up. I second the other recommendations to use some sort of source control system like cvs, svn, git, etc to check files in/out for working on different workspaces/PCs. I've done that many times with good results.
Why can't you just setup you favorite IDE once then export/import your settings to another PC?
That way you'll deal with IDE config issues.
Then configure Maven build for your project so all the dependencies and stuff can be resolved automatically during the build process.
And as last step you should setup git repo for the project - Github/Bitbucket, for example.
Leaving home => push all your daily work; came home => pull all updates and continue working.

New to GitHub - is there a way to get an overview of projects on it before unzipping and building?

I've been looking for a finished/working ImageView on Android that has pinch/zoom behavior. Although there are code-snippets all over S.O. for this I want something a little more finished that I can just build and use.
GitHub, which I've never used before, seems to have candidates. As far as I can tell GitHub is a free, public project-hosting, source-control system, but I'm only interested in downloading and trying out projects on it, which can be done by the "Download Zip" button on it.
I recently tried a project called PhotoView but after getting it all imported into my Eclipse development environment I found it had dependencies on a higher API level than I was using or targeting.
Is there any way to avoid that in the future? I.e., is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Edit: In my browser I can see a brief revision history but it looks like it only goes back a few changes so the manifest or other key files aren't always visible. Is the only way to see the project files to download the ZIP file, unpack it and look at it in my development environment on my local PC?
Thanks in advance.
Is there any way to avoid that in the future?
Browse the source code. For example, the manifest file (for the component or a demo app) should indicate the android:minSdkVersion.
is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Yes. It's called the project README, and you were already there, most likely, as it is the "home page" of the repository. The amount of documentation any given developer will write for any given component will vary.
You are also welcome to file issues against the project, asking for more documentation on this sort of thing, but if and when that issue will be acted upon will also vary.
readme file in root of the project, and Wikipages of that repositories could help you find out additional information about that repository. But at the end, contributors are responsible to prepare this kind of information and some of them don't care. So, you can look for Android manifest file of the project and check the content in GitHub website before download and unzip it.

Categories

Resources