I have lost the source code of my flutter application due to drive corruption, but I have my debug.apk
in my android phone.
How can I decompile the Flutter apk
to get source code?
I have tried decompiling it using decompilers but it is not giving my source code
as the Flutter source code is in Dart language.

- 14,885
- 4
- 25
- 52

- 4,031
- 4
- 15
- 33
-
Possible duplicate of [Is there a way to get the source code from an APK file?](https://stackoverflow.com/questions/3593420/is-there-a-way-to-get-the-source-code-from-an-apk-file) – F-1 Dec 07 '18 at 10:24
-
flutter applications source code is in dart language , can java decompilers decompile other language code ? – Jagraj Singh Dec 07 '18 at 15:03
-
try it and let us know – F-1 Dec 07 '18 at 16:00
-
1sure , btw I recovered my project using easeus and now its running fine. Thanks for your concern . – Jagraj Singh Dec 07 '18 at 16:08
-
1@F-1 I have tried decompiling the apk and I am not getting my dart code . – Jagraj Singh Dec 07 '18 at 16:38
-
@estn I am new to this community sir , I haven't asked a duplicate question but it is showing this question may have an answer here . can you please tell me sir how to remove that . I already edit my question with more specific info but it is still showing the same. – Jagraj Singh Dec 07 '18 at 18:08
-
@JagrajSingh have you find a solution? – Luigi Saggese May 02 '19 at 13:59
-
@LuigiSaggese No , not yet . btw I had tried java decompilers but got nothing . – Jagraj Singh May 02 '19 at 17:02
-
@JagrajSingh The same question as Luigi: do you have a solution now? – slow Aug 06 '19 at 14:46
-
Well I tried @user3467955 's answer and I got small code snippets rather full code. You could try that . – Jagraj Singh Aug 08 '19 at 18:23
-
Better use github/gitlab :) – Phani Rithvij Dec 06 '19 at 07:45
1 Answers
If your debug.apk is in debug mode then you can use apktool
in order to extract the components of the apk
(I'm using the word extracting since apk
is a zip file).
Flutter, in debug mode, keeps the source code (with comments!) in the file kernel_blob.bin. Thus, using the following command should help you extract the code into a file:
strings /path/to/extracted/apk/assets/flutter_assets/kernel_blob.bin > extracted_code.dart
Please, pay attention - You'll need to clean 'extracted_code.dart', from irrelevant/garbage strings.
Try to search strings like "dart", "import", "void" and other keywords in 'extracted_code.dart', it will help you find the code itself.
Here's an example from my Ubuntu:
If the apk
is compiled in "release" mode, extracting the code will be much harder, since the code is compiled into isolate_snapshot_instr file, which is not a raw arm assembly, and is only deserialized using the Flutter engine in run-time. You can read more about it here

- 5,867
- 4
- 32
- 56

- 561
- 5
- 11
-
Better search for filename, your class names, or some regex like `runApp\(.*\(\)\);` in vscode or using `sed`. Because the file would be very big eg: 25MB and `470850` lines. – Phani Rithvij Dec 06 '19 at 07:44
-
1Please how do i perform this operation on windows. Windows can't seem to find command "strings". Thanks – Brendan Apr 12 '20 at 11:02
-
1Hey, you can [https://learn.microsoft.com/en-us/sysinternals/downloads/strings](download strings) for your Windows machine – user3467955 Apr 14 '20 at 16:02
-
https://medium.com/@rondalal54/reverse-engineering-flutter-apps-5d620bb105c0 – Kamlesh May 26 '21 at 13:11
-
REALLY THANKS!!! It works. Was writing a game with my son, and everything got lost during Git operations. And this helped! There was a lot of byte code, but search by file and variable names worked. – wowkin2 Aug 13 '22 at 14:46