Is there a way to get the source code from an APK file?

前端 未结 27 1869
难免孤独
难免孤独 2020-11-21 06:56

The hard drive on my laptop just crashed and I lost all the source code for an app that I have been working on for the past two months. All I have is the APK file that is st

27条回答
  •  梦毁少年i
    2020-11-21 07:46

    These two articles describe how to combine the use of apktool and dex2jar to take an APK file and create an Eclipse project that can build and run it.

    http://blog.inyourbits.com/2012/11/extending-existing-android-applications.html

    http://blog.inyourbits.com/2012/12/extending-existing-android-applications.html

    Basically you:

    1. Use apktool to get the resource files out of the apk
    2. Use dex2jar to get a jar file that contains the classes in a format that Eclipse will like.
    3. Create an Eclipse project point it at the resource files and the new jar file
    4. Open the jar file with a zip utility and delete the existing resources
    5. Open the jar file with JDGui to view the source code
    6. Take whatever source code you need from JDGui, stick it in a class inside Eclipse and modify it
    7. Delete that class from the jar file (so you don't have the same class defined multiple times)
    8. Run it.

提交回复
热议问题