androidcopysmali

How can i copy a file in smali


I'm reverse engineering an app. I want to copy an image from res/drawable to internal storage in smali The java code is FileUtil.copyFile("android.resource://com.package.name/drawable/app_icon.png", "/storage/emulated/0/App_name/icon/");

I just want this code in smali language

I want to convert it into smali.


Solution

  • There is an easy option to generate Smali code from Java code:

    Just use AndroidStudio, create a new App project, and paste the Java code you want to have in the onCreate method of the main Activity (or add a custom method).

    Then build the APK and decompile it using Apktool or Jadx (Jadx can display for each class also the Smali code) to get the Smali code. Just copy the relevant parts out of the shown smali code.