一個APK反編譯利器Apktool(android漢化)

來源:互聯網
上載者:User
反編譯出來的是smali,作者:http://jf.andblogs.net/google了一下:

smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The syntax is loosely based on Jasmin's/dedexer's syntax, and supports the full functionality of the dex format (annotations, debug info, line info, etc.)

The names "smali" and "baksmali" are the Icelandic equivalents of "assembler" and "disassembler" respectively. Why Icelandic you ask? Because dalvik was named for an Icelandic fishing village. 

 

具體的,往下看吧!

隨便把MobileQQ1_0(Android)_Beta2_Build0214整了一把。

轉載自:http://blog.sina.com.cn/s/blog_5752764e0100kv34.html APK 本地化 [http://www.andmoto.com/viewthread.php?tid=3873]說起APK的漢化,目前大部分教程都是讓用Hex Workshop或者Android ResEdit來做。但是實際操作後,就會發現:
1、Hex Workshop操作繁瑣,經常出現搜不到想要修改的字元的情況;
2、Android ResEdit簡單用用可以,修改稍微複雜一點就會出現整條整條丟字串的情況;並且新內容不能比原內容長——誰能保證我的本地化語言就一定比原來的短 呢?

現在好了,老外寫的《android-apktool》軟體,可以協助我們把APK反編譯,產生程式的原始碼和圖片、XML配置、語言資源等檔案。我們對 圖片和語言資源等檔案修改後,可以再把它們編譯打包成APK,簽名後就是手機可以安裝的本地化/修正版APK了。

《android-apktool》軟體軟體可以訪問它的首頁http://code.google.com/p/android-apktool/下 載獲得,apktool-1.0.0.tar.bz2和apktool-install-windows-2.1_r01-1.zip兩個包都要下。下載 後解開,為了方便使用,按作者的推薦把得到的4個檔案複製到C:/Windows檔案夾裡。

這個工具是Java寫的,需要你的電腦安裝了JRE或者JDK,並在系統內容變數Path裡加入java.exe所在路徑。

以上準備工作做好後,就可以用它來反編譯APK了。這裡我用動態壁紙的APK來做示範。

如果用過動態壁紙,你也許會發現在設定壁紙時,介面的顯示有點問題:“動態壁紙”,在手機上中文顯示為“當前壁紙”。這是“動態壁紙選擇 器”LiveWallpapersPicker.apk的翻譯錯誤造成的。

(假設LiveWallpapersPicker.apk放在C盤根目錄)

開始 > 運行,輸入cmd,斷行符號。

  1. apktool d "C:/LiveWallpapersPicker.apk" "C:/LiveWallpapersPicker"

複製代碼

(命令列解釋:apktool d 要反編譯的檔案 輸出檔案夾)

這樣,LiveWallpapersPicker.apk就被反編譯了,輸出內容在C:/LiveWallpapersPicker檔案夾裡。

開啟C:/LiveWallpapersPicker檔案夾,我們發現裡面有一些XML檔案和一些檔案夾。絕大部分情況下,語言和圖片資源都在res檔案 夾裡,我們這個例子當然不例外。

開啟res檔案夾,可以其中又是很多檔案夾。(又是)絕大部分情況下,語言資源都放在values*檔案夾裡。比如說values放預設語言(英語居 多),values-de放德語,values-fr放法語等等。一般我們關心的是values-zh-rCN(簡體中文)和values-zh- rTW(繁體中文)。

開啟values-zh-rCN檔案夾,其中有個strings.xml。開啟看看:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="application_name">動態壁紙選取器</string>
<string name="live_wallpaper_picker_title">當前壁紙</string>
<string name="live_wallpaper_preview_title">當前壁紙預覽</string>
<string name="configure_wallpaper">設定...</string>
<string name="wallpaper_instructions">設定壁紙</string>
<string name="live_wallpaper_empty">無當前壁紙。</string>
<string name="set_live_wallpaper">設定壁紙</string>
<string name="wallpaper_title_and_author">%1$s提供者:%2$s</string>
<string name="live_wallpaper_loading">正在載入當前壁紙…</string>
</resources>



很好,就是它了。把“當前壁紙”都改為“動態壁紙”,再檢查和修正標點——中文內容用中文標點(強烈呼籲大家注意標點問題,目前馬大哈太多了)後, 儲存。

本例改這麼多就夠了。其它複雜的APK建議把res檔案夾裡的內容都檢查下,至少你關心的語言檔案夾裡的內容都檢查下。

改完後,就可以重打包了。還是在cmd命令列裡,輸入:

  1. apktool b "C:/LiveWallpapersPicker"

複製代碼

(命令列解釋:apktool b 要打包內容所在檔案夾)
就可以了。產生的APK在C:/LiveWallpapersPicker/dist檔案夾裡,叫out.apk。

這個out.apk是沒有簽名的,所以不能直接裝到手機裡。簽名工具和方法見http://www.hiapk.com/bbs/thread-21261-1-1.html, 這裡不說了。

簽名後得到的APK,就是可以裝到手機裡的了。

操練:去掉免費版軟體的廣告條
[http://bbs.ophone8.net/viewthread.php?tid=18082]
開啟google code發現Apktool更新了,居然支援win了。。。。
那本文就是一篇介紹在windows環境下使用Apktool的筆記。
安裝

1.先裝JAVA環境,JDK/JRE都行,官網下載 裝過的就跳過吧

2.下載apktool.jar及相關檔案,這裡下apktool-1.0.0.tar.bz2 和apktool-install-windows-2.1_r01-1.zip


3.解壓apktool.jar到 C:/Windows 解壓apktool-install-windows.zip到任意檔案夾(例如E盤根目錄)
4.Win+R 運行CMD,用cd命令轉到apktool-install-windows所在檔案夾,輸入apktool看看。會列出一些協助的話就成功了。 Apktool 命令


apktool d XXX.apk ABC 反編譯 XXX.apk到檔案夾ABC
apktool b ABC 從檔案夾ABC重建APK,輸出到ABC/dist/out.apk

然後我們反編譯一枚軟體玩玩…
AutoMemoryManager的免費版底部有一條廣告,去掉它吧。
把com.lim.android.automemman.apk放到同檔案夾(我的就是E盤根目錄)
Win+R 運行CMD
E:<斷行符號>
E:/>apktool d com.lim.android.automemman.apk AMM <斷行符號>
I: Baksmaling…
I: Decoding resource table…
I: Decoding resources…
I: Copying assets and libs…
現在檔案被decode到E:/AMM了,開啟E:/AMM/res/layout/main.xml看,所有都可見了吧~
編輯第59行


<com.admob.android.ads.AdView android:id=”@id/ad” android:layout_width=”fill_parent” android:layout_height=”wrap_content” admobsdk:backgroundColor=”#ff000000″ admobsdk:textColor=”#ffffffff” admobsdk:keywords=”Android application” />


改為


<com.admob.android.ads.AdView android:id=”@id/ad” android:layout_width=”0.0dip” android:layout_height=”0.0dip” admobsdk:backgroundColor=”#ff000000″ admobsdk:textColor=”#ffffffff” admobsdk:keywords=”Android application” />


然後CMD輸入
E:/>apktool b AMM
I: Checking whether sources has changed…
I: Smaling…
I: Checking whether resources has changed…
I: Building resources…
I: Building apk file…
用Auto-sign簽名E:/AMM/dist/out.apk 安裝
這樣廣告就不見了

再看,嘿嘿~很帥吧…

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.