0

After decompiling an Android application, I am able to view its source code/Java classes by opening the classes.dex file using jd-gui. I need to add a few lines of code to the application before recompiling it and installing the modified app onto a phone. The problem is that even though I can view the source code, I am unable to add code to it. Is there anyway I can add code to the application instead of only being able to view it? I have tried importing into Eclipse, but I cannot obviously import the classes.dex file, and need a way to do that.

user3694391
  • 133
  • 1
  • 2
  • 12
  • 1
    You can't change the APK directly like this. You need to go all the way through the pipeline: Java source -> Java bytecode -> Dex bytecode -> package the APK -> sign the APK. By the way, what are you trying to achieve? To hack a someone else's app? – Natix Jul 08 '14 at 15:54
  • maybe ask for someone's code and then add your few lines if you get the source – marcus m Jul 08 '14 at 15:57

1 Answers1

1

You have to use APKTool. Also check out this Smali coding guide. Not easy as you think.

Lazy
  • 1,807
  • 4
  • 29
  • 49