1

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.

Vivz
  • 6,625
  • 2
  • 17
  • 33
PSM
  • 429
  • 4
  • 15

2 Answers2

5

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.

Long Ranger
  • 5,888
  • 8
  • 43
  • 72
  • So there is no way to reverse engeenier an apk and use it on Android Studio? – PSM Aug 17 '16 at 10:39
  • You should avoid to do so because it is quite a complicated work if you do so. Try to build a simple Hello world apk. and decompile using the tools http://stackoverflow.com/questions/21010367/how-to-decompile-an-apk-or-dex-file-on-android-platform and then rebuild it using Android studio. You will know what the problems are when you are going to do reverse engineering in Android. – Long Ranger Aug 18 '16 at 01:27
3

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 .

Daniel
  • 106
  • 3