7

Few days back my Hard Drive courrupted due to this I lost my whole project files. I have an .apk file of that project.

but problem is that the .apk files contain 100% Kotlin language. I found one way to decompile code, but bad luck it doesn't decompile back to Kotlin code. After decompiling I got some weird type written .java classes.

Please help me how can I decompile my .apk file, it was a very important project for me. Is any way please suggest :)

Simulant
  • 19,190
  • 8
  • 63
  • 98
Kaunain
  • 168
  • 3
  • 16
  • 1
    There are dex to Java decompilers, but I haven't heard of any for Kotlin. But you could use Android Studio to convert the Java to Kotlin. The decompiled code will never look as pretty as the original source. There's no way for the decompiler to know what your code looked like before it was optimized by the bytecode compiler. Also, don't develop anything without version control and backups. BitBucket and GitHub both allow you to back up private projects for free. – Tenfour04 Oct 09 '20 at 17:29
  • Absolutely, it's a pity about what happened, but if you don't have a backup or you didn't push to a remote version control, there's not much you can do to restore the entire project to its original state. You can certainly decompile the .class files back into Java (never seen a KT decompiler yet), but you won't get formatting, comments, project structure, etc. back. :/ May this be a reminder to all users that there are plenty of _free_ `git` (and others) hosting places on the Internet; not onlly `github` or `gitlab` or `bitbucket` (assuming you're not in a blocked country) :/ – Martin Marconcini Oct 12 '20 at 08:44
  • thanks for reply...actually i got my project back...what i did, i just decompile my apk and from that i didn't get my project wriiten in kotlin it was written in java...i just make a new project with same package name and i started coping my .kt file and Luckily my java code automatically converted in kotlin by **SMART IDE - ANDROID STUDIO** :) but still i did some changes in that files becz it contains many redundant files ..that was automatically generated – Kaunain Oct 16 '20 at 14:38
  • @Kaunain Hi could you please elaborate how you solved it? I see lots of errors when decompiling from `.class` to `.java` and cannot proceed... – ch271828n Mar 11 '22 at 01:48
  • @ch271828n as I mentioned in above comment you just do the same. Decompile you apk and you will get **.java class** then just make a new project and copy codes and paste in **new .kt** class and **IDE** will automatically convert your **.java to .kt** but there will be some error you have to analyze and solve it. If this project i done by yourself only then you can solve that error easily. I know you have to do some efforts, because there is no any other way to decompile apk to source code. In my case it took one week to get my project back. – Kaunain Mar 11 '22 at 17:30
  • @Kaunain Thanks! When I get `.java` class it is very ugly and contains tons of strange symbols and variables, and even get compile errors... – ch271828n Mar 12 '22 at 00:47

1 Answers1

1

To decompile Kotlin code from an APK file, you may use a few tools that are available.

FernFlower: Kotlin code may be decompiled using FernFlower, a Java decompiler. The APK file may be decompiled using FernFlower to produce Java code, which can then be converted back to Kotlin code using a tool like IntelliJ IDEA.

there some more online websites you search on google and also use apk easy tool in windows to decompile source code.