Skip to content
sonyericssondev edited this page Apr 13, 2012 · 5 revisions

Installation failure on System Apps

If the original app is also installed as a system app (in /system/app folder), it has to be uninstalled before installing the modified APK file, because ApkAnalyser will use test certificate to sign it and it will cause inconsist certificate error.

The app was invisible in "Settings->Manage applications" and unable to uninstall via ADB uninstall.

Thus, there are two ways to remove the app

  • create another SW build of your phone without the app
  • remove the app at runtime.

For the 2nd solution, this is the instruction. Here we use VoiceSearch as an example..

Make sure you have the root permission

backup the following files (recommanded)

  • /system/app/VoiceSearch.apk
  • /system/app/VoiceSearch.odex (in most cases, this file doesnot exist because the app is not in odex format)
  • /data/system/packages.xml

remount /system as read-write

    C:\>adb remount
    remount succeeded

delete the app

    C:\>adb shell rm /system/app/VoiceSearch.apk
    C:\>adb shell rm /system/app/VoiceSearch.odex (it's ok to ignore it for non odex app)

get /data/system/packages.xml

    C:\>adb pull /data/system/packages.xml
     861 KB/s (0 bytes in 151590.000s)

search in packages.xml for "VoiceSearch" and remove the following lines:

   <package name="com.google.android.voicesearch" codePath="/system/app/VoiceSearch.apk" flags="1" 
    ts="1217592000000" version="160" userId="10051">
   <sigs count="1">
   <cert index="11" />
   </sigs>
   </package>

write the modified packages.xml back to the device

    C:\>adb push packages.xml /data/system/packages.xml
     727 KB/s (0 bytes in 151389.000s)

reboot the device

    C:\>adb reboot

Only one device is supported

Make sure that only one device you want to use for debugging is connected though ADB. ApkAnalyser does not support selecting devices. Thus, please turn off other devices before install the application, e.g. emulators.

Out of memory error

You may use the -Xmx parameter to increase the heap size. just try it on 1024m. If not enough you may increase it further.

    java -Xmx1024m -jar ApkAnalyser.jar

Cannot apply bytecode offset injection(e.g. custom log) on move-result* and move-exception instructions

move result* must be done as the instruction immediately after an invoke instruction and move-exception should be the first instruction of any exception handler, thus you are not able to inject there.

Solution: inject the next instruction after it.

Startup error on Ubuntu

If you get the following error on Ubuntu:

    $ java -jar ApkAnalyser.jar
    /usr/share/themes/Human/gtk-2.0/gtkrc:51: error: lexical error or unexpected token, expected valid token

Or it says AWT lib is missing. You may try below steps:

  • switch to the default Human theme in System -> Preferences -> Appareance

  • install Oracle JDK 6 or later

  • make sure the default java used on your system is Oracle JDK

      sudo update-alternatives --config java