Flutter调试Apk反编译以获得源代码 [英] Flutter debug Apk decompile to get source code
问题描述
由于驱动器损坏,我丢失了flutter应用程序的源代码,但是我的debug.apk
在我的Android手机中.
谁能告诉我如何反编译Flutter apk
以获得源代码.
我尝试使用反编译器对其进行反编译,但未提供我的源代码
因为flutter的源代码是dart语言.
I have lost the source code of my flutter application due to drive corruption, but I have my debug.apk
in my android phone.
Can anyone please tell me how to 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.
推荐答案
如果您的debug.apk处于调试模式,则可以使用apktool
来提取apk
的组件(我正在使用提取单词,因为apk
是zip文件).
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在调试模式下,将源代码(带有注释!)保留在文件kernel_blob.bin中.因此,使用以下命令应该可以帮助您将代码提取到文件中:
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
请注意-您需要清除无关/垃圾字符串中的"extracted_code.dart".
Please, pay attention - You'll need to clean 'extracted_code.dart', from irrelevant/garbage strings.
尝试在"extracted_code.dart"中搜索诸如"dart","import","void"和其他关键字之类的字符串,它将帮助您找到代码本身.
Try to search strings like "dart", "import", "void" and other keywords in 'extracted_code.dart', it will help you find the code itself.
这是我的Ubuntu的一个示例:
Here's an example from my Ubuntu:
如果apk
是在发布"模式下编译的,则提取代码将更加困难,因为代码已编译到isolate_snapshot_instr文件中,该文件不是原始的程序集,并且仅使用Flutter引擎进行反序列化.运行.您可以在此处了解更多信息
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
这篇关于Flutter调试Apk反编译以获得源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!