XAppDbg is an app development tool that can be used to change parameters in your code during runtime. This can save you a lot of time, since you don’t have to build and run your application for each small change.
We have published XAppDbg as open source, and it can be downloaded from the XAppDbg project at Developer World’s GitHub. For a more extensive introduction, read our XAppDbg blog post. Any questions, comments or ideas for contribution can be posted in the XAppDbg thread in the XDA forum. We are monitoring this thread to answer your posts and continuously publish new information about the XAppDbg tool.
How to download and setup XAppDbg for your project
- Download XAppDbg from the Sony GitHub.
- Remove the final keyword from the constants in your code, so the parameters can be changed during runtime. It can be good to also move all the constants inside an inner class, so they are isolated.
- Include the XAppDbgServer library in your project, by adding the XAppDbgServer.jar to the Java build path. For example, in Eclipse: Project Properties -> Java Build Path -> Libraries -> Add jar…
- In the code, setup an instance of the server. Exactly how this will look depends on your application, but here is an example:
// Create and start the debug server mServer = <b>new</b> XAppDbgServer(); mServer.addModule(<b>new</b> XAppDbgPropertiesModule(Consts.<b>class</b>)); mServer.start();
The first line just creates a server instance. The XAppDbgPropertiesModule scans the fields of an object or class, and exposes all the public fields it finds. The third line starts the server, and it will be listening on port 55011. In order for this to work, the application must have the INTERNET permission.
- Run the application you’re developing on your phone.
- Use a USB cable to connect the phone to the computer. In order for the client application on the computor to be able to connect to the phone using TCP/IP, you need Android Debug Bridge (ADB) to forward the port. This means that the following command needs to be executed in a shell every time your device is connected to the computer via the USB cable:
$ adb forward tcp:55011 tcp:55011
- Now when you start the client application, you just need to click on “Connect localhost”, and you’re ready:
Now you can change any of your parameters during runtime on the computer and see the effect of the change immediately on your phone, without rebuilding the application.
When you are satisfied with the result, just copy the values from the client back into your source code and rebuild it.
For more information about XAppDbg, check out the following links: