Android studio import problems. (Apktool)

房东的猫 提交于 2019-12-08 07:17:15

问题


I have been trying to import a file to android studio that I decompiled using apktool. But when I try to import the file to Android studio it does not show anything on the "Project" browser. While in the import process, in the first step, I chose "Create project from existing sources". Is there anyway to fix this problem? Also, is there anyway to use in android studio a file from notepad++?

Thanks.


回答1:


As Daniel Souza replied, apktool is just a tools to help you to extract the class and manifest. If you look into the detail and the flow of the Android build process (https://source.android.com/source/jack.html), you will know every class will be obfuscated, packed and put it into the .dex file(include your own classes, android support library and other 3-party libraries).

Normally, the .apk file only included the following types of file.

  1. .dex files (it might be not only one if the problem of 65K methods exists)
  2. manifest( Android permission and features meta-data)
  3. asset (Drawable, asset folders, layout and R)

Therefore, when you used apktools and some other tools(j-soup) to do some reverse-engineering. You can only have the source files only. And as Daniel method, you can import the project to the android studio but many errors might be existed into your project.

  1. R.java cannot be generated (since all the custom id value will be converted to be a unqiue integer in the apk., this cannot be reversed as human-readable meaning even you use the apktool)

  2. Obfuscated class and variable name. As I mentioned the process of how the apk built, the class and variable name will be obfuscated after building. Reverse engineering will be difficult to findout the logic inside the application since almost all the name are renamed as (a,b,c,d,e...)

  3. Proguard problem, some application might use advanced technologies to compile the source code using more complex logic flow ( like Dexguard did). After you finish reverse engineering, it will be more difficult to findout the inside logic in the application.

If it is a "Simple" application, you might be able to find out what happen in the obfuscated code.

If it is a "Complex" application including a lot of libraries, it will be disaster if you are trying to dig out the logic inside it.




回答2:


apktool is a reverse engineering tool that generates the source, but not the gradle build scripts, which is why it does not show up as a project you can open. You have to "import from existing sources" because apktool only generates the source files and Android Studio will attempt to fill in the gradle build files.

Once you import the project, you can add any files you like to your project's directory. This includes ones that you generate from other programs including Notepad++. You can do this in Android Studio with from Project View (Alt+1) with Copy/Paste or Drag/Drop .



来源:https://stackoverflow.com/questions/38986158/android-studio-import-problems-apktool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!