For the past month and a half I have been working on a project, an app for Android. Today my computer crashed. Apparently the backup didn't backup the source files for any of my projects though; it only backed up the drawable folders for some reason?
Anyway, I was wondering if there was a way to recover the source code from the app on the phone somehow. I never fully finished the app and created an .apk or anything, but I ran it on my phone several times for debugging purposes, so it is on my phone in a fairly recent state. Is there a way to somehow recover the source code for this? I would hate to have to redo anything, but it seems like I'm probably going to have to end up doing that.
I began the project in Eclipse Indigo but later switched IDEs to IntelliJ IDEA. The files I currently have on my computer are:
An EML file for the project. It appears to be blank.
The drawable folders
And that's it. Any ideas?
You can use dex2Jar to get a jar and then use JD-GUI to examine the code. Since it is decompiling it will not be exact, but close.
dex2jar: http://code.google.com/p/dex2jar/
JD-GUI: http://java.decompiler.free.fr/
You could look into this as an option:
It is a tool for reverse engineering 3rd party, closed, binary Android
apps. It can decode resources to nearly original form and rebuild them
after making some modifications; it makes possible to debug smali code
step by step. Also it makes working with app easier because of
project-like files structure and automation of some repetitive tasks
like building apk, etc.
http://code.google.com/p/android-apktool/
You can try file recovery softwares to get back your deleted files from your hard disk(if it is working).
These softwares worked for me in recovering pictures from a formatted SDCARD. So you can give it a try.
You may be able to use IntelliJ IDEA's "local history" feature. IntelliJ keeps track of all your edits in .IntelliJIdea10 folder in the use home. If that folder has not been damaged in the crash you should be able to recover all your codes.
Just right click on the module directory in the Project tab and select Local History > Show History. Wait for the list of history items to load, it may take a couple of seconds. Right click on an item in the left panel and select Revert.
Related
I'm coming from NetBeans and evaluating others and more flexible IDEs supporting more languages (i.e. Python) than just php and related.
I kept an eye on Eclipse that seems to be the best choice; at the time I was not able to find an easy solution to keep the original project on my machine and automatically send / syncronize the files on the remove server via sftp.
All solutions seems to be outdated or stupid (like mounting a smb partition or manually send the file via an ftp client!
I'm not going to believe that an IDE like Eclipse doesn't have a smart solution of what I consider a basic feature of an IDE, so I think I missed something... On Eclipse forums I've seen the same question asked lots of time but without any answer!
Some suggestions about is strongly apreciated otherwise I think the only solution is stick on one IDE each language I use that seem to be incredible on 2018.
I'm developing on MacOS and the most interesting solution (kDevelop) fails on building with MacPorts.
Thank you very much.
RSE is a very poor solution, as you noted it's a one-shot sync and is useless if you want to develop locally and only deploy occasionally. For many years I used the Aptana Studio suite of plugins which included excellent upload/sync tools for individual files or whole projects, let you diff everything against a remote file structure over SFTP when you wanted and exclude whatever you wanted.
Unfortunately, Aptana is no longer supported and causes some major problems in Eclipse Neon and later. Specifically, its editors are completely broken, and they override the native Eclipse editors, opening new windows that are blank with no title. However, it is still by far the best solution for casual SFTP deployment...there is literally nothing else even close. With some work it is possible to install Aptana and get use of its publishing tools while preventing it from destroying the rest of your workspace.
Install Aptana from the marketplace.
Go to Window > Preferences > Install/Update, then click "Uninstall or update".
Uninstall everything to do with Aptana except for Aptana Studio 3 Core and the Aptana SecureFTP Library inside that.
This gets rid of most, but not all of Aptana's editors, and the worst one is the HTML editor which creates a second HTML content type in Eclipse that cannot be removed and causes all kinds of chaos. But there is a workaround.
Exit Eclipse. Go into the eclipse/plugins/ directory and remove all plugins beginning with com.aptana.editor.* EXCEPT FOR THE FOLLOWING which seem to be required:
com.aptana.editor.common.override_1.0.0.1351531287.jar
com.aptana.editor.common_3.0.3.1400201987.jar
com.aptana.editor.diff_3.0.0.1365788962.jar
com.aptana.editor.dtd_3.0.0.1354746625.jar
com.aptana.editor.epl_3.0.0.1398883419.jar
com.aptana.editor.erb_3.0.3.1380237252.jar
com.aptana.editor.findbar_3.0.0.jar
com.aptana.editor.idl_3.0.0.1365788962.jar
com.aptana.editor.text_3.0.0.1339173764.jar
Go back into Eclipse. Right-clicking a project folder should now expose a 'Publish' option that lets you run Aptana's deployment wizard and sync to a remote filesystem over SFTP.
Hope this helps...took me hours of trial and error, but finally everything works. For the record I am using Neon, not Oxygen, so I can't say definitively whether it will work in later versions.
I've been working on a project in IntelliJ IDEA for about two months now. Today, when I fired up the IDE, which would usually open project straight up, IntelliJ took unusually long time to load, and when it did open the project, the main .java file displayed a long line of spaces and nothing else, instead of the code that was there before. The .iml file, the only other thing in the project, was fine. An error message was on the top:
"This document contains very long lines. Soft wraps were forcibly enabled to improve editor performance."
Trying to edit the document results in the entire program freezing and becoming unresponsive. What the hell happened? It was fine one day and then just did this, how do I get my project back and how do I prevent this?
Solved in the comments below the question; thought I might as well post a dummy answer and mark this as resolved.
EDIT: Solution written out.
Right click on file > Local History > Show History
Find any suspicious changes in the list on the left. Be especially on lookout for "External changes", as those can indicate crashes and sudden power-outs. Alternatively, look for times when you remember your computer crashed or power went out while IntelliJ was open.
Revert the changes(curved purple arrow in the upper left corner). Restart the IDE if it's going slow. Everything should work properly now.
Somehow, whatever code I add to my program it does not run on my android device. It just runs my old code.
I am constantly deleting my app from my phone in the App Manager.
If I add new or change functionality the old code still runs.
I even delete complete blocks of code that should obliterate functionality. But somehow all the old functionality remains in the app after reinstall.
Simple example: On a TextButton click i shift some UI element by 200. This works great. When i delete the complete button listener it still works great but i guess completely by itself since the code should be gone.
I tried restarting Eclipse without luck.
This thing is driving me crazy. I was stuck for hours on some simple code and baffled why it did not run. Then I discovered my logs where not showing in logcat. Somehow, sometimes it does update the new code into the device since now i have a log on device resume but i deleted that at least 30 minutes ago and now it is still showing in my logcat.
Desktop app works as it should. I somehow have the feeling this happened before and over time this got worse, up to this point where i cannot test anything anymore.
So to be clear:
I add code to my app.
Run it from eclipse as Android application
No changes show up
Delete app from phone using the phones Application Manager
Delete a complete code block like the show() method that holds my complete stage
Run it from eclipse as Android application
App still runs as it was with the complete stage in tact.
-- edit --
Now I did not do anything to my code for a while and ran it. Now it probably took the code with the version with the empty show() method. However this already has been undone in the present. Could eclipse be stacking runs?
Check
"Project -> Build Automatically"
is checked. (Most likely your problem).
Also doing a
"Project -> Clean..."
tells the IDE to delete any previously compiled binaries and rebuilds them. (The APK file).
This could happen if there is an error in your code and you have selected run without warning when error in program exists. In such a case the last successfully built code would get pushed! As Lestat mentioned try doing a clean, if the project now shows up errors you have your culprit, else make sure your XML files are all proper.
Another check could be to see the timestamp of the last generated apk file in your workspace.
PS: There is a bug in eclipse where it doesnt save a file at time, a simple workspace restart fixes this.
Had the same issue - updated my code and yet the phone was running the old.
Tried Build --> Clean Project
Tried File --> Invalidate Caches/Restart
Now it works and recognizes the new code!
That said curious what #1 and #2 did behind the scenes??
I'm working on eclipse and sometimes I have to delete some lines of code that indeed I prefer to backup on a notepad file (because I never know if that lines of code could be useful in another moment), so I have to select all the code I have to delete, ctrl+x, open a text editor, ctrl+v, and save it somewhere.
I was searching for a "code recycle bin plugin", so that I can select the code to trash, right click and "send to code recycle bin"; and in the future the deleted code is still there if I need it.
You can achieve a similar effect by configuring your workspace Local History settings:
What I'm gathering from your question is that you often modify code in such a way that you're not sure if it will work after you modify it. What you need is a software versioning system.
Often, because a coder may introduce new code that is faulty or introduces unnecessary defects, we need to revert back to the last working version. There is an easier way than "Ctrl+X"ing the code and placing it in a "recycle bin" for future use. Try using a software versioning system such as Git for better results. The source code is available online, and you can get an account for free.
In short, version control system will stop you from having to juggle files unnecessarily.
There is something similar which will resolve your issue, the Eclipse Remus project. You can download the plugin via the Eclipse Marketplace. After installation you can open the Remus Navigation view in your Java perspective, select the code and drop the code into the Navigation-Structure of the Remus Navigation view. The dropped source-code will be saved.
For all of you android devs out there that have the Android simulator running on your comp, you know that there are a few built in apps that are already installed on your 'phone'. I had an idea for an app that would utilize a function that is already being done in the spare parts app that comes already installed.
I went on to the android developer site, dug through the source code files, and found the spare parts app, and am now trying to set it up so that running it from eclipse on my machine actually runs the app in the simulator. In other words, I want to be able to make changes to and adjust some of the things in that app for my own needs. But it won't compile, because of a number of different errors.
How do I get that source code running on my local machine? Is there some special trick that I just dont know about? I thought that if I could get the source code than the rest would be easy, but it isn't being too easy.
Not knowing what the error is, it is hard to say. But there are some tricks. First, you want the entire spare parts app in Eclipse, not just the code you are interested in running. Second, right click on your project, and go down to the "Android Tools" menu. Then click on "Fix Project Properties". Do a clean on your project and hopefully that will help.