Android 的反编译 (附愤怒的小鸟源码下载)
阅读源码是最好的学习方法,下面我们以愤怒的小鸟为例,看看如何把一个android游戏反编译成可读的源码。
工具介绍:
1、apktool 这个工具用来解压xml文件
到http://code.google.com/p/android-apktool/downloads/list 下载前两个文件,并解压到Android SDK的platform tools 目录。
在命令行里的用法:
apktool d 你的apk.apk 解压到指定文件夹,例如:
apktool d F:\学习\android\反编译\愤怒的小鸟.apk F:\学习\android\反编译\愤怒的小鸟
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1620" android:versionName="1.6.2" android:installLocation="auto" package="com.rovio.angrybirds"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="@string/app_name" android:name="com.rovio.ka3d.App" android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.burstly.VideoPlayerActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.burstly.BurstlyFullscreenActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<provider android:name="com.greystripe.android.sdk.AdContentProvider" android:exported="false" android:multiprocess="true" android:authorities="com.rovio.ka3d.AdContentProvider" />
<activity android:name="com.greystripe.android.sdk.AdView" android:configChanges="keyboard|keyboardHidden|orientation">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.millennialmedia.android.MMAdViewOverlayActivity" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboard|keyboardHidden|orientation" />
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.jumptap.JumptapActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
</manifest>
<manifest android:versionCode="1620" android:versionName="1.6.2" android:installLocation="auto" package="com.rovio.angrybirds"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="@string/app_name" android:name="com.rovio.ka3d.App" android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.burstly.VideoPlayerActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.burstly.BurstlyFullscreenActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<provider android:name="com.greystripe.android.sdk.AdContentProvider" android:exported="false" android:multiprocess="true" android:authorities="com.rovio.ka3d.AdContentProvider" />
<activity android:name="com.greystripe.android.sdk.AdView" android:configChanges="keyboard|keyboardHidden|orientation">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.millennialmedia.android.MMAdViewOverlayActivity" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboard|keyboardHidden|orientation" />
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.burstly.lib.component.networkcomponent.jumptap.JumptapActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
</manifest>
这就是我们加压后的AndroidManifest文件,我们看到愤怒的小鸟总共有8个activity
2、dex2jar 这个工具是将dex文件反编译成jar文件
到http://code.google.com/p/dex2jar/downloads/list下载这个工具,并将所有文件和文件夹加压到并Android SDK的platform tools 目录。
用法:
dex2jar F:\学习\android\反编译\classes.dex 这里是把dex文件反编译成jar文件,默认会在该目录生成一个classes_dex2jar.jar文件。
3、xjad 这个工具是将jar文件反编译成java文件
这是一个可视化的将jar文件反编译成java文件的工具,直接反编译jar会自动生成一个包含java文件的文件夹。
愤怒的小鸟源码下载:
http://dl.dbank.com/c0olagap0k