Set-up Ubuntu to edit Android APK’s (Apps) using Apk Manager

NOTE: This post is rather outdated and is currently being revised. Proceed on at your own risk.

Adding the ability to edit Android apps (apk’s) in Ubuntu is fairly easy, but lacks documentation. The following steps are what worked for me on my system, but please continue at your own risk. Since every system is different, I can’t guarantee that this will work for you, but it should serve as a good basis.

Things you will need:

Setting up the Android SDK:

To start with we will set up the Android SDK as APK manager relies on it.

First download the Android-SDK for linux from here. Once downloaded extract it somewhere to your system (I chose my user folder for ease of access).

If you don’t have Java JDK installed you will need to do so by running the following:

sudo apt-get install sun-java6-jdk

Once this is done you will need to install the Andoid SDK addon “Platform-tools” as APK manager relies on it to function.

To do so navigate to the following path (be sure and replace with the actually path you extracted to):

/path-to-extracted-android-sdk/tools/

Once here, locate the file called “android.” Double click it and select run.

After the graphical interface is loaded, select “Available Packages” in the right hand column. This will open up a list of package Repos in the center column. Expand the “Android Repository” and place a check by “platform-tools.” Now click install selected and let it do it’s magic.

The SDK (with platform tools) is now set-up and ready to use.

Adding the Android SDK to your path

At this point you have the Android SDK and Platform-Tools installed. This means that you can use them, but only within the directory where they exist. This is very inconvenient, so we are going to make them accessible anywhere by running the following commands (be sure and replace with the actually path you extracted to):

First we need to edit the .profile file:
gedit ~/.profile

Once opened, add the following to the very end:

export PATH=${PATH}:~/android-sdk-linux_x86/tools
export PATH=${PATH}:~/android-sdk-linux_x86/platform-tools

Save and exit and run the following back in the terminal:

export PATH=$PATH{}:/home/user/android-sdk-linux_x86/tools:/home/user/android-sdk-linux_x86/platform-tools

Installing APK Manager dependencies:

APK manager requires a few packages to run. Every system will be different, but my system was lacking optiping and 7zip. To install them run the following:

sudo apt-get install optipng p7zip-full sox

If you are on a 64bit system you may also need the following:

sudo apt-get install ia32-libs

Installing APK Manager

Finally, after all the prep work we are ready to install APK Manager.

First download the package from here.

Next, extract it somewhere on your system. (again, I chose my user folder)

Now open the terminal and navigate to the extracted APK manager and set the permissions of all the files in the folders to 755.

Example (in terminal):

chmod -R 755 /home/user/apkmanager

To finish up the installation you will want to run APK Manager. This first run will create the necessary folders to place your APK to be edited ect.

Run APK Manager by executing Script.sh inside the APK manager directory.

cd /home/user/apkmanager
./Script.sh

All finished

Assuming all went well you should now be all set-up, and ready to start using APK Manager to edit your APKs.

17 Comments

  1. Hi, Craig. Thanks for the post and for the site. I have been following the instructions and I am not sure I did it well. After running the Script in Terminal, what should happen? I see a Terminal that opens and closes very fast. Does that means something went wrong with installation? Thanks again.

  2. Diego, Did you receive any errors during the installation?

    Also, when you run the script, open a terminal in the directory that APK manager is in, then run ./Script.sh and tell me if there are any errors.

    There is actually an easier method to install apkmanager now, so if we cant get you going this way I can show you an alternative.

    Thanks for stopping by.

  3. Craig, hi again. Yes, I received “errors”. When I run the sudo apt-get install, console tells me: E: Unable to locate package optiping. I am copy/pasting this line:
    sudo apt-get install optiping p7zip-full sox

    But maybe I am not doing something well. I have an XP installed on my PC. I tried to run the APK Manager and they run in Java but I am never able to zipalign them. Not in the “place-apk-here-for-modding” folder, not in any other folder.

    Anyway, I will love that Ubuntu options works. It is my favorite part of my PC.

    Thanks again for the blog and for answering.

  4. Hi, again. I tried the second solution. I ran ./Script.sh on the console, from inside the apk folder. I received more errors related with the undownloaded repositories:
    “The program optiping is missin or is not in your PATH, please install it or fix…”
    It says the same about: 7za, abd, aapt and sox.
    The PATH edition did nor worked, right? adb should be there, and aapt maybe too. Anyway, I could not download 7za or Sox.
    What do you think?

  5. Craig:

    I will check the tutorial you linked. I have no problem with any method, as long as it works. Anyway, I do not like to leave something unsolved. And now that I am trying to download extras, console tells me:

    Cannot access PPA (https://launchpad.net/api/1.0/~user/+archive/ppa-name) to get PPA information, please check your internet connection.

    Connection is perfect. Any idea why this happens? Just to be sure, is it my pc configuration or it is the repository creating the message?

    Thanks for the new link. I will check it. Do you know a simple way to zipalign .apk files? I am creating them with Android Book App Maker. They are widgets/books for android. I can not upload them to Google Play because of the zipaligning…

    Thanks.

  6. Craig.

    I have the APK Manager working. Thanks for the post. I tryed also the tutorial you send on a link. Great idea the andadb.sh, altough I have a couple of questions. Maybe you can help me.

    The andadb.sh tries to install android SDK and NDK on my computer. But I already have an SDK because of the Eclipse instalation. How should this be handle? Should I install separatelly the NDK? Is it already installed with the Android (Eclipse) SDK combo?

    Thanks for your time, man.

    Diego.

  7. Hello, again.

    Sorry for having so many questions. I am trying to zipalign apk files made with Android Book App Maker (ABAM). Apk Manager (APKM) works, i think, because it ask me if I want to clean before starting on the prompter. I place the apk on the modding folder, and then I run the zipalign option and it gives me back:
    zipalign: cannot find file ‘place-apk-here-for-modding/repackaged-unsigned.apk’
    Might be the APKM instalation or is it the apk created by ABAM (it says the apk is signed with a “home made” key).

    Thanks again.

  8. Found a typo? Maybe – I’m learning here too. in: [sudo apt-get install optiping p7zip-full sox], optiping should be optipng. When I ran [sudo apt-get install optipng p7zip-full sox] in terminal, it worked.

  9. May I ask a question? I follow every instruction without trouble. apk_manager runs on my pc (Ubuntu 12.04), platform tools and tool from sdk are on my path, but when I I try to zipalign my apk, it tells me “./Script.sh: 92: ./Script.sh: zipalign: not found”. Do you know if I am missing something? Thanks. Bruno.

  10. @craig Layne i did what u said but in the final step’s where chmod is needed can u tell me what shud i type if my apkmanager folder is on desktop,, plz help me i just installed Linux today for the first time, i am running Windows 8 pro,,,,,,,,, 😉

  11. Hello Shivam,

    Sorry for the late reply. I am going to bet that you have this sorted out by now, but here is the command:

    chmod -R 755 /home/user/desktop/apkmanager

    Be sure and replace with your username.

Leave a Reply