简体   繁体   English

从Android手机上的未完成应用程序恢复源代码

[英]Recovering Source Code from Unfinished App on Android Phone

For the past month and a half I have been working on a project, an app for Android. 在过去一个半月里,我一直致力于一个项目,一个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. 我从来没有完全完成应用程序并创建了一个.apk或任何东西,但我在手机上运行了几次以进行调试,因此它在我的手机上处于相当新的状态。 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. 我在Eclipse Indigo中启动了该项目,但后来将IDE切换到IntelliJ IDEA。 The files I currently have on my computer are: 我目前在计算机上的文件是:

  • An EML file for the project. 项目的EML文件。 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. 您可以使用dex2Jar获取jar,然后使用JD-GUI检查代码。 Since it is decompiling it will not be exact, but close. 因为它是反编译它不会是精确的,但接近。

dex2jar: http://code.google.com/p/dex2jar/ dex2jar: http//code.google.com/p/dex2jar/

JD-GUI: http://java.decompiler.free.fr/ 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. 它是逆向工程第三方,封闭式二进制Android应用程序的工具。 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. 它可以逐步调试smali代码。 Also it makes working with app easier because of project-like files structure and automation of some repetitive tasks like building apk, etc. 此外,由于类似项目的文件结构和一些重复性任务(如构建apk等)的自动化,它使应用程序更容易。

http://code.google.com/p/android-apktool/ 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. 这些软件可以帮助我从格式化的SDCARD恢复图片。 So you can give it a try. 所以你可以尝试一下。

You may be able to use IntelliJ IDEA's "local history" feature. 您可以使用IntelliJ IDEA的“本地历史记录”功能。 IntelliJ keeps track of all your edits in .IntelliJIdea10 folder in the use home. IntelliJ会在use home中的.IntelliJIdea10文件夹中跟踪所有编辑内容。 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 . 只需右键单击Project选项卡中的模块目录,然后选择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 . 右键单击左侧面板中的项目,然后选择“ 还原”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM