How do you back up an android app? - java

I just had my app crash and now after alot of work its back to were I had it, I was wondering how would I back up the app so I can reInstall is again if this ever happens again?

u should use a version control system, example: git version control
http://git-scm.com/
happy coding!

use a version control system.. like svn or git ... in any case even if you were not using this, you should have taken backup of your code regularly... these version control system manages this for you easily...

This question is not specific to Java or Android, but rather, how to "backup" code properly. As others have already mentioned, you should be using source control systems such as Git or Subversion. Not only will this "backup" your code, it will allow you to track the changes you make to the code as well as maintain multiple versions of your code.

Related

Is there a way that I can get back my accidently deleted code in eclipse?

A couple of days ago, I was copying and pasting my code into a new class. While the entire code was selected, I hit the backspace key. The entire code deleted, and I did not realize. My computer then died. Today, I opened it back up, and none of the code was there. The only thing that remained was an empty file. Is there anything I can do?
The two comments cover most of it. There are only 3 places your code could possibly be. If you checked them all and none of them have it, you're out of luck.
Eclipse Local History
Right click the file in the package explorer and pick the 'Restore from local history...' option. Hurry up, eclipse auto-removes local history that's older than 7 days!
VCS
If you're using version control and you checked this in before, it's a simple restore away. For example, git checkout path/to/the/file.java would do it. You'd have to explain which VCS system you are using and how are you accessing it (via eclipse teams, via e.g. Fork.app, via the command line, etc).
Backups
You're using a computer. It should have backups. These backups need to run automatically and preferably be going 'off site' (to a place that you do not live, you don't want a fire or some serious burglary to mean you have lost both your system and your backup!). If you don't have that, you're, uh, well, I don't want to insult you, so you should find some suitable insult that describes a very silly person and then yell that at a mirror.
The only excuse to not have backups for a system is if the system does everything in the cloud. Chromebooks really don't need it for example. If you're programming, unless it's some fancy cloud-based programming layout, this does not apply to you, and therefore you should be finding a mirror right about now if you don't have a backup solution in place.
There are open source tools like arq where you fully control where the data goes. Various NAS (Network-Attached-Storage) systems have the option to sync with another NAS elsewhere over the network, so buy one for yourself and for a friend, and be each other's backup buddy. Or just toss some money at it; services like Backblaze offer fixed fee backups and offer client side encryption if that's a worry for you.

Reverting source code to Java after IntelliJ's Kotlin > Java conversion

So I wanted to try out converting our backend API source code which is written in Java and see how it looks (IIRC there is a preview before converting), but once I did it it automatically started converting all the files in the selected folders, and in the end it asked for code corrections, which I responded with no as I wanted to cancel it and now I am stuck with a broken code base with no other options than:
Reverting to the last git commit and reimplementing all the changes done from my side (I could have prevented it but committing before the conversion but oh well)
Continue using Kotlin to code in but I have code errors which I don't know how to fix
What I am asking instead is if there's anyway to convert Kotlin back to Java in IntelliJ IDEA? Thank you in advance
Intellij has a feature called Local History and it can be used to go back in time for things you did not commit to your source control system. This history is retained until you install a new version of IntelliJ IDEA or invalidate caches. Read more in the Intellij help for the feature.
Your source code constantly changes as you edit, test, or compile. Any version control system tracks the differences between the committed versions, but the local changes between commits pass unnoticed. Local History is your personal version control system that tracks changes to your source code on your computer and enables you to compare versions and roll changes back, if necessary. Local History is always at your disposal, no steps are required to enable it.
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.

Recover corrupted java file

I tried to reimport my android project on eclipse to solve a problem but I accidently overwrote all my files in the project. All of them had been corrupted which means their size is now 0B...
I tried to use Local History but it's useless since my project is no longer in my workspace, same for .metadata.
I also tried to use Recuva (Software for recovering files) which see my files with their real size but when I try recover them, their size is always 0B...
I lost about 7 days of work and I don't really want to rewrite my code using Java Decompiler...
So my question is, is there any solution to recover that files ?
I wrote 200 lines of code and suddenly system restarted. I lost all code. But I recovered data from eclipse's local history. Right click on the file -->replace with-->previous from Local History
Eclipse has a local history, although by default it's set very low - one of my first tasks when setting up a new development machine is to up the values (in addition to my other version control)
If you do have a history you can right click on your class, and select compare with local history.
You could try decompiling with something like JD-GUI. It might not be as onerous as you think. Obfuscators exist for a reason.
It is not really programming question, but i had similar situation and "Mini Tool Power Data Recovery" tool helped me (it is paid tool, free version exists, but maybe you can search in this direction and find something open source). I tried some another tools then, but with no results.

Java Updater Game Launcher

I'm trying to make a Java game updater launcher for my game. Similar to how minecraft works. However, minecraft has only a few .jar's to download wheras I would need to redownload all of my game assets. Is there any easy way for Java to check a file for which operations need to be taken? One idea I had was using .7z files since those can be compressed really small. That wouldn't work though because I can't seem to get Java to hook onto 7zip operations. Another idea I had was if it determined if an update was needed it would read a file with a set of commands like this:
remove assets/models/malecharacter.obj
add assets/models/alien.obj
...etc
But I'm not sure this is very efficient and I am also not able to find a lot of help with managing files. Any help and ideas would be appreciated.
I made a Game Launcher in Java recently, I still have a few problems to solve like how to update the launcher itself.
Anyhow, for the game updates/versions I just have a "versions" folder with a folder for each downloaded version, it might not be the prettiest of solutions but it works for multiple versions and it's easy to make.
My launcher checks a URL from my dedicated server which has all available versions, which I call it versionlist, then since the versions folder on the server obeys a path order I can call any versions which are in the versionlist. I download the selected version and extract it to a separate version folder on the user's pc.

I need to import my apk into eclipse - possible?

I am an app developer, and I recently had to re-install windows, so I lost all of my app data :(
I have the apps on the market, so can get the APK's, but my question is:
Can I decompile them back into eclipse, or will I have to re-make them from scratch?
Thanks for your answers, Liam
Unfortunately, there's not any way to get your source code back from just an apk.
I highly recommend in the future using a source control management system (I use git) and back up online (I use bitbucket).
I doubt very much the APK contain your source, unless you configure your build to include them. So no, you can decompile each class and reconstruct some of the code, but chances are, u have to rebuild from scratch.

Categories