Apktool + Eclipse Dynamic Debug apk

Source: Internet
Author: User

Use will andbug, although quite strong but as accustomed to OD. EDB as a dynamic debugging tool of the people, naturally some not accustomed to, and then seek new dynamic debugging solutions. But most of them are NetBeans + apktool. Think of more of the next IDE on all sorts of irritability, or to seek a combination of eclipse.


Http://code.google.com/p/android-apktool/wiki/SmaliDebugging

Find Apktool's official website and see the ability to implement dynamic debugging.

The ability to add android:debuggable= "true" to the manifest file in the target apk by setting the parameters at the time of decompile and writeback, at the same time in order to combine eclipse. After that, he will take the initiative to change the. Smali suffix to. java. This can be used for debugging.

Of course, don't forget to return to PostScript also need to sign and so on. So I wrote a simple script:

"' Created on 2014-5-28@author:xbalien '" Import osimport sysimport subprocessclass Apkdebugger (object): Def unpackagin g (Self, Apk_path): print ' Start unpackaging ... ' Subprocess.call ([' Apktool_2.0.0b9.jar ', ' d ', '-d ', apk_path],sh ELL=TRUE) def packaging (self, file_path): print ' Start packaging ... ' Subprocess.call ([' Apktool_2.0.0b9.ja R ', ' B ', '-d ', file_path],shell=true) def signer (self, unsigned_path): print ' Start Signing ... ' signer_comm= [' Jarsigner ', '-verbose ', '-keystore ', ' key ', '-digestalg ', ' SHA1 ', '-sigalg ', ' md5withrsa ', '-signedjar ', ' signed.apk ' ] Signer_comm + = [Unsigned_path, ' key '] p = subprocess. Popen (signer_comm,stdin=subprocess. Pipe,stdout = subprocess. PIPE, stderr = subprocess. PIPE, Shell = True) p.communicate (input= ' key123456 ') p.wait () def zipalign (self, outapk_path): Sub Process.call ([' zipalign ', '-V ', ' 4 ', ' signed.apk ', outapk_path],shell=true) if __name__ = = ' __main__ ': If Len (SYS.ARGV) & Gt;1:        print ' Start Create apkdebugger ... ' apk_path = sys.argv[1] File_path = apk_path[:-4] Unsigned        _path = './' +file_path+ '/dist/' +apk_path outapk_path = file_path+ '//' +apk_path Apk_debugger = Apkdebugger () Apk_debugger.unpackaging (Apk_path) apk_debugger.packaging (file_path) Apk_debugger.signer (unsigned_ Path) apk_debugger.zipalign (outapk_path) else:print ' useage:main.py apk_name '

After the script has been processed well. The APK is also generated. Then install it on your phone. Click Execute. This time can be viewed through DDMS



At this point, open Eclipse and create a new javaproject. Add source (anti-compile Code Smali folder)



We can then open a breakpoint on the file.


Then set the Debug configuration file, select Remote Debugging and the corresponding port to start debugging


then click Debug. This is the time to start clicking on the phone. It breaks down at the corresponding breakpoint.


Then you can have a pleasant step

Apktool + Eclipse Dynamic Debug apk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.