XAppDbg

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 on 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

  1. Download XAppDbg from the Sony GitHub.
  2. 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.
  3. 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
  4. 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 = new XAppDbgServer();

mServer.addModule(new XAppDbgPropertiesModule(Consts.class));

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.

  1. Run the application you’re developing on your phone.
  2. 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

  1. Now when you start the client application, you just need to click on “Connect localhost”, and you’re ready:

Screenshot of the connection dialogue of the XAppDbg client.

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.

Screenshot showing the XAppDbg client for the computer.

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: