Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,666 Members 39,682 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][HOW TO][13.04][13.10][14.04]APKTool on Ubuntu (Complete Installation)

Tip us?
 
nilac8991
Old
(Last edited by nilac8991; 7th September 2014 at 12:51 PM.) Reason: Updated openjdk-7
#1  
nilac8991's Avatar
Senior Member - OP
Thanks Meter 738
Posts: 624
Join Date: Nov 2012
Location: Oradea

 
DONATE TO ME
Cool [GUIDE][HOW TO][13.04][13.10][14.04]APKTool on Ubuntu (Complete Installation)

In this guide, i will show you how to install correctly Apktool without any kind of problem and to explain the basically commands

So, let's start!
First of all we will need to install these packages and tools:

Code:
-Java (Last version)
-Androdid SDK  
-Some 32bit Lib (Just for users who have 64bit running machines)


Java

To install Java just open a terminal window, and type the following commands:
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer


Android SDK
For the Android SDK go Here ,download the bundle and once finished extract it...
Next, you will need to install these dependencies that will be added to java:

Code:
sudo apt-get install openjdk-7-jre
sudo apt-get install openjdk-7-jdk
sudo apt-get install icedtea6-plugin
Once finished this, go to the extracted folder and go the tool folder...
Next open a terminal and type
Code:
./android
and make a SDK update by installing the latest packages.
Finished this, go to the Home folder and search for bashrc (It's a hidden file so, to see it make CTRL + H)
Open it and add these lines above all the lines you find.
Code:
 #AndroidDev PATH
  export PATH=${PATH}:~/android-sdk-linux_x86/tools
  export PATH=${PATH}:~/android-sdk-linux_x86/platform-tools


OK, now we are ready to install APK Tool!
- Go Here and Here and download these files..
- Now extract all these files to your desktop
- Now open a terminal window and navigate to your desktop (cd Desktop), once there type the following commands
Code:
sudo chown -R Your username:Your username aapt
sudo chown -R Your username:Your username apktool        
sudo chown -R Your username:Your username apktool.jar
sudo chmod +x aapt
sudo chmod +x apktool
sudo chmod +x apktool.jar
sudo cp aapt /usr/local/bin
sudo cp apktool /usr/local/bin
sudo cp apktool.jar /usr/local/bin


Now to make sure that APK Tool really works users with 64bit machines will need to install these libs:
Code:
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
Ok so now APK Tool should really be installed correctly on your computer
Now i will explain just the basically commands to know:
Code:
apktool if framework-res.apk
This command is recommended to be done at the first run, because this string install the framework-res of your ROM wich it will be used then in future to decompile the other APKs
Code:
apktool d SystemUI.apk OUT
This string decompile an apk and the world OUT is just the folder that it will be created, so you can write any name you want or you can just say :
Code:
apktool d SystemUI.apk
And the name will be auto generated
Code:
apktool b SystemUI
Once you finished working on an APK this string will recompile the APK with the modified things. If you're done correctly the modifications then the terminal will not tell you anything
But remember!, finished to recompile an APK copy the META-INF folder from your original APK and paste it in the build/apk folder which is located in the root folder of your decompiled apk and if you didn't modified the AndroidManifest do the same also for it.If you modified the APK and added some new chneges like .png or other files you will need to sign that APK, so to do that first download the Mini Package once you downloaded and extracted it, go to the folder and open a terminal window. To sign an APK you will need to type the following string:
Code:
java -jar signapk.jar testkey.x509.pem testkey.pk8 name_of_app.apk name_of_app-signed.apk
It is not required to write signed in the second name, because that is just the name of the new signed apk so you can write any kind of name you like
So pretty much that's it
If you're find any kind of problem during the recompilation of the APK don't panic, re-watch the guide you are following to see if you made good the steps, or search on Google, your best friend
Thanks, and i hope this will help some people
The Following 21 Users Say Thank You to nilac8991 For This Useful Post: [ Click to Expand ]
 
ShinySide
Old
(Last edited by ShinySide; 14th August 2014 at 05:38 AM.)
#2  
ShinySide's Avatar
Senior Member
Thanks Meter 1,980
Posts: 1,729
Join Date: Nov 2013
Location: IHB
Nice guide Think its the best Ive seen for installing on Linux. Wish I found this the first time I installed it on Linux.

Im lazy, hate typing, and change distros often so i turned it all into a script a while back. But think this is great for newbies.

Great work bud.

edit-

Posted 2 weeks ago and only 3 thanks? Come on people. Be thankful for this. Not too long ago you could barely even find one guide for this let alone one put together well. Hit the thanksssssss.
The Following User Says Thank You to ShinySide For This Useful Post: [ Click to Expand ]
 
bm19981217
Old
(Last edited by bm19981217; 14th August 2014 at 06:28 AM.)
#3  
Junior Member
Thanks Meter 2
Posts: 23
Join Date: Jun 2014
I already searched for it but didn't find an answer: How do I sign an apk on ubuntu?
Nice guide, will do it AS soon AS I have time.
Sent from my Nexus 5 using XDA Free mobile app
 
nilac8991
Old
(Last edited by nilac8991; 14th August 2014 at 10:29 AM.)
#4  
nilac8991's Avatar
Senior Member - OP
Thanks Meter 738
Posts: 624
Join Date: Nov 2012
Location: Oradea

 
DONATE TO ME
Quote:
Originally Posted by ShinySide View Post
Nice guide Think its the best Ive seen for installing on Linux. Wish I found this the first time I installed it on Linux.

Im lazy, hate typing, and change distros often so i turned it all into a script a while back. But think this is great for newbies.

Great work bud.

edit-

Posted 2 weeks ago and only 3 thanks? Come on people. Be thankful for this. Not too long ago you could barely even find one guide for this let alone one put together well. Hit the thanksssssss.
Thanks man )
I will add also a mini guide for signing this afternoon

edit. added mini guide also for signing
 
EnricoD
Old
#5  
EnricoD's Avatar
Recognized Contributor / Themer
Thanks Meter 3,938
Posts: 2,208
Join Date: May 2013
great work, very useful for noobs

If You install oracle's java You don't need the open jdk

This is user's choice


Why not the 7 instead of 6th?
Code:
sudo apt-get install openjdk-7-jre
It's possible also to make this process faster by adding a wget instead of downloading all apktool things from the website

for example i uploaded apktool files on my dropbox and I download everytime I have to install apktool by simply running

Code:
wget https://www.dropbox.com/s/6s9bxszxjl7wclz/apktool.tar.gz
then

Code:
tar -zxvf apktool.tar.gz
then

Code:
cd apktool
You can also run single commands to make the installation process faster

Code:
sudo chmod +x aapt apktool apktool.jar
Code:
sudo chown -R yourusername aapt apktool apktool.jar
enricod@enricod-Aspire-5920G:~/Scrivania/apktool$

Code:
sudo cp aapt apktool apktool.jar /usr/local/bin
just hints
The Following 2 Users Say Thank You to EnricoD For This Useful Post: [ Click to Expand ]
 
nilac8991
Old
(Last edited by nilac8991; 14th August 2014 at 11:35 AM.)
#6  
nilac8991's Avatar
Senior Member - OP
Thanks Meter 738
Posts: 624
Join Date: Nov 2012
Location: Oradea

 
DONATE TO ME
Yeah sure it can be done also in this way
The Following User Says Thank You to nilac8991 For This Useful Post: [ Click to Expand ]
 
paulle
Old
(Last edited by paulle; 14th August 2014 at 01:03 PM.) Reason: edit
#7  
paulle's Avatar
Senior Member
Thanks Meter 166
Posts: 833
Join Date: Nov 2010
Default ubuntu 14.04 ia32libs

in ubuntu 14.04 (64bit) the ia32libs aren't available.

Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0

Package 'ia32-libs' has no installation candidate
 
nilac8991
Old
(Last edited by nilac8991; 14th August 2014 at 03:06 PM.)
#8  
nilac8991's Avatar
Senior Member - OP
Thanks Meter 738
Posts: 624
Join Date: Nov 2012
Location: Oradea

 
DONATE TO ME
Quote:
Originally Posted by paulle View Post
in ubuntu 14.04 (64bit) the ia32libs aren't available.

Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0

Package 'ia32-libs' has no installation candidate
These are required optionally just in case the APKTool may fail during his running
but if they are necessary type the following commands:

Code:
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
 
typos1
Old
#9  
Senior Member
Thanks Meter 39
Posts: 444
Join Date: Apr 2007
I ve got Android sdk, Java and adb already on my 64 bit system, is it ok to leave out installation of those bits and just start by installing the APK tool, but miss out the 32bit libs cos I already have them ? Thanks
Motorola m301 - Ericsson PF768 - Ericsson T28 - Siemans SL45 - Panasonic GD87e - SPV E200 (HTC Voyager) - SPV C500 (HTC Typhoon) - SPV C550 (HTC Hurricane) - O2 XDA Graphite (Asus Jupiter) - Samsung Omnia - Samsung Galaxy S2 - Newman N2 - Oppo Find 5
 
ShinySide
Old
#10  
ShinySide's Avatar
Senior Member
Thanks Meter 1,980
Posts: 1,729
Join Date: Nov 2013
Location: IHB
Quote:
Originally Posted by typos1 View Post
I ve got Android sdk, Java and adb already on my 64 bit system, is it ok to leave out installation of those bits and just start by installing the APK tool, but miss out the 32bit libs cos I already have them ? Thanks
Yeah just skip what you already have and install what you don't have

The Following User Says Thank You to ShinySide For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes