Program/Android Java

[HOW TO] Use Apktool

너구리V 2012. 9. 27. 14:34

What do you need:
JRE (Java Runtime Environment)

Install:

Windows:
Download apktool 
Windows-r04
Unpack both pakages you will get three files, copy those files to your Windows directory i.e. C:\WINDOWS

Decoding files:
Open Command. Run>cmd
Type-
Quote
apktool d file.apk [directory]
Example - apktool d D:\nfsshift.apk D:\nfsshift
Done!


FrameworkFiles

Apktool needs the framework files to decode and build apks.

Standard framework is embedded into apktool, so you don't need to do anything for most apk files. But some manufacturers, for example Samsung, add their own framework files and use them in system apps. To use apktool against such apps, you must pull framework from a device and install/register it to apktool.

For Example, you want to decode TouchWizLauncher.apk from Android v2.2 of Galaxy 5. If you try to do that, you will get an error message:


You need to install framework in apktool Type-

apktool if [framework location]


I have the got the framework-res.apk & twframework-res.apk by extracting the ROM. You can also copy it from your phone. But take care you must copy framework.apk from that ROM in which you got the Application file.




Then try again 


Now is working.


How to build decoded files:
Just type

apktool b [directory in which you have decoded the files]
Example - apktool b D:\nfsshift
Done!



You will find the apk file inside the decoded directory, like I found it in - D:\nfsshift\dist\nfsshift.apk

Now you need to sign your APK file.


How to Sign APK files:


When publishing an application or a custom rom you need to sign the .apk or .zip files with a certificate using a private key. The Android system uses the certificate to identify the author of an application and establish trust relationship between applications. The classic way of doing this was to use keytool then sign it with jarsigner. In this tutorial i’ll explain an alternative method which is relatively easy to use for most people using a tool called SignApk.jar.

First download the SignAPK tool
Extract them to a directory you will remember. I have put them in C:\SignApk

Now just open cmd and type -
Quote

cd C:\SignApk
java -jar signapk.jar certificate.pem key.pk8 your-app.apk your-app-signed.apk
Example - java -jar signapk.jar certificate.pem key.pk8 D:\nfsshift\dist\nfsshift.apk D:\nfsshift\dist\nfsshift-signed.apk



Your APK is signed and can be installed.

반응형

'Program > Android Java' 카테고리의 다른 글

[Android] WebView Settings  (0) 2012.10.02
[Android/안드로이드] JSON Parser ( 제이슨 파서 )  (0) 2012.09.27
WebView 한글 문제  (0) 2012.09.27
microlog4android 사용  (0) 2012.09.06
Google Analytics SDK for Android  (0) 2012.09.06