ææ°çåç¼è¯ä¸ç¨æ¤æ¹æ³ï¼ æææ°çä¸é®èªå¨åç¼è¯å·¥å
·ï¼
è¿æ®µæ¶é´å¨å¦Androidåºç¨å¼åï¼å¨æ³æ¢ç¶æ¯ç¨Javaå¼åçåºè¯¥å¾å¥½åç¼è¯ä»èå¾å°æºä»£ç å§ï¼googleäºä¸ä¸ï¼ç¡®å®å¾ç®åï¼ä»¥ä¸æ¯æçå®è·µè¿ç¨ã
å¨æ¤éé声æï¼è´´åºæ¥çç®çä¸æ¯ä¸ºäºå»ç ´è§£äººå®¶ç软件ï¼å®å
¨æ¯ä¸ç§å¦ä¹ çæ度ï¼ä¸è¿å¥½åéè¿è¿ç§æ¹å¼ä¹å¯ä»¥å»æ±åä¸äºå¤å½è½¯ä»¶ã
注ï¼æ¬Androidåç¼è¯æç¨ï¼å¨Windows7-Ultimate-64bitæä½ç³»ç»ä¸ï¼æµè¯éè¿ï¼
ä¸è¿°æéçåç¼è¯å·¥å
·å
ä¸è½½
ä¸ãåç¼è¯Apkå¾å°Javaæºä»£ç
é¦å
è¦ä¸è½½ä¸¤ä¸ªå·¥å
·ï¼dex2jaråJD-GUI
åè
dex2jaræ¯å°apkä¸çclasses.dex转åæJaræ件ï¼èJD-GUIæ¯ä¸ä¸ªåç¼è¯å·¥å
·ï¼å¯ä»¥ç´æ¥æ¥çJarå
çæºä»£ç ã以ä¸æ¯ä¸è½½å°åï¼
dex2jarï¼
http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zipJD-GUIï¼
http://laichao.googlecode.com/files/jdgui.zipå
·ä½æ¥éª¤ï¼
é¦å
å°apkæ件ï¼å°åç¼æ¹ä¸ºzipï¼è§£åï¼å¾å°å
¶ä¸çclasses.dexï¼å®å°±æ¯javaæ件ç¼è¯åéè¿dxå·¥å
·æå
èæçï¼
解åä¸è½½çdex2jarï¼å°classes.dexå¤å¶å°dex2jar.batæå¨ç®å½ãå¨å½ä»¤è¡ä¸å®ä½å°dex2jar.batæå¨ç®å½(å¨DOSå½ä»¤ä¸CD ç®å½)
è¿è¡
dex2jar.bat classes.dex
çæ
classes.dex.dex2jar.jar
çæjaræ件çæªå¾å¦ä¸ï¼
è¿è¡JD-GUIï¼jd-gui.exeï¼ï¼æå¼ä¸é¢çæçjarå
ï¼å³å¯çå°æºä»£ç äº
HelloAndroidæºç ï¼ç¼è¯åçapkæºç 对ç
§ï¼å¦ä¸ï¼
äºãåç¼è¯apkçæç¨åºçæºä»£ç åå¾çãXMLé
ç½®ãè¯è¨èµæºçæ件
å¦ææ¯æ±å软件ï¼è¿å°ç¹å«æç¨ãé¦å
è¿æ¯ä¸è½½å·¥å
·ï¼è¿æ¬¡ç¨å°çæ¯apktool
ä¸è½½å°åï¼
http://code.google.com/p/android-apktool/downloads/listä¸è½½ï¼apktool1.4.1.tar.bz2 å apktool-install-windows-r04-brut1.tar.bz2ï¼ä¸¤ä¸ªå
é½ä¸è½½ï¼
å
·ä½æ¥éª¤ï¼
å°ä¸è½½ç两个å
解åå°åä¸ä¸ªæ件夹ä¸ï¼åºè¯¥ä¼æä¸ä¸ªæ件ï¼aapt.exeï¼apktool.batï¼apktool.jar
å¨å½ä»¤è¡ä¸å®ä½å°apktool.batæ件夹ï¼è¾å
¥ä»¥ä¸å½ä»¤ï¼apktool d C:\*.apk C:\*æ件夹ï¼å¦ä¸å¾ï¼
å½ä»¤è¡è§£éï¼apktool d [apkæ件 ] [è¾åºæ件夹]
åç¼è¯çæ件å¦ä¸ï¼AndroidManifest.xml为ä¾ï¼ï¼
ç¹å«æ³¨æï¼ä½ è¦åç¼è¯çæ件ä¸å®è¦æ¾å¨Cççæ ¹ç®å½éï¼å
¶å®ä¸ç¨æ¾å¨Cçæ ¹ç®å½ä¹è¡ï¼
ä¾å¦ï¼å¨Dçç®å½D:\apktool1.4.1
cd /d D:\apktool1.4.1 //åæ¢å°Dçç®å½ï¼å
å«HelloAndroid.apk以åaapt.exeï¼apktool.batï¼apktool.jarä¸ä¸ªæ件
apktool.bat d -f HelloAndroid.apk HelloAndroid // apktoolåç¼è¯å½ä»¤ï¼æ³¨æ då
-f çåæ³
å°åç¼è¯å®çæ件éæ°æå
æapkï¼å¾ç®åï¼è¾å
¥apktool b c:\***æ件夹ï¼ä½ ç¼è¯åºæ¥æ件夹ï¼å³å¯ï¼å½ä»¤å¦ä¸ï¼è¿ä¸ªä¸»æä½ æ件æå¨ç
æå
apkåçæ件å¨ç®å½C:\HelloAndroidä¸ï¼çæäºä¸¤ä¸ªæ件夹ï¼
build
dist
å
¶ä¸ï¼æå
çæçHelloAndroid.apkï¼å¨ä¸é¢çdistæ件夹ä¸ï¼Ok
æåï¼åä»ç»ä¸æ¬¾ååºæ¥çåç¼è¯å·¥å
· Androidfby ï¼å®æ¯ä¸æ¬¾å¯¹ä¸è¿°æ¥éª¤è¿è¡äºå°è£
çå¾å½¢çé¢å·¥å
·ï¼ä¸è½½å°å
ä½æ¯ï¼é对é¨åç¾åçapkï¼æ æ³å®ç°åç¼è¯ï¼ä½æ¬å客æ¹æ³åä»ç¶å¯ä»¥åç¼è¯æåï¼ä»
ä¾åè使ç¨
å¦å¤ï¼ä½ä¸ºåºç¨å¼åè
ï¼è¯å®ä¸å¸æèªå·±ç代ç 被åç¼è¯çï¼ä¸ä¸éå客å°è®²è¿°å¦ä½éè¿æ··æ·ä»£ç é²æ¢è¢«å«äººåç¼è¯
Androidå¦ä½é²æ¢apkç¨åºè¢«åç¼è¯
ä½ä¸ºAndroidåºç¨å¼åè
ï¼ä¸å¾ä¸é¢å¯¹ä¸ä¸ªå°´å°¬çå±é¢ï¼å°±æ¯èªå·±è¾è¾è¦è¦å¼åçåºç¨å¯ä»¥è¢«å«äººå¾è½»æçå°±åç¼è¯åºæ¥ã
Googleä¼¼ä¹ä¹åç°äºè¿ä¸ªé®é¢ï¼ä»SDK2.3å¼å§æ们å¯ä»¥çå°å¨android-sdk-windows\tools\ä¸é¢å¤äºä¸ä¸ªproguardæ件夹
proguardæ¯ä¸ä¸ªjava代ç æ··æ·çå·¥å
·ï¼éè¿proguardï¼å«äººå³ä½¿åç¼è¯ä½ çapkå
ï¼ä¹åªä¼çå°ä¸äºè®©äººå¾é¾çæç代ç ï¼ä»èè¾¾å°ä¿æ¤ä»£ç çä½ç¨ã
ä¸é¢å
·ä½è¯´ä¸è¯´æä¹æ ·è®©SDK2.3ä¸çproguard.cfgæ件起ä½ç¨ï¼å
æ¥ççandroid-sdk-windows\tools\lib\proguard.cfgçå
容ï¼
[html] view
plaincopyprint?
1. -optimizationpasses 5
2. -dontusemixedcaseclassnames
3. -dontskipnonpubliclibraryclasses
4. -dontpreverify
5. -verbose
6. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7.
8. -keep public class * extends android.app.Activity
9. -keep public class * extends android.app.Application
10. -keep public class * extends android.app.Service
11. -keep public class * extends android.content.BroadcastReceiver
12. -keep public class * extends android.content.ContentProvider
13. -keep public class * extends android.app.backup.BackupAgentHelper
14. -keep public class * extends android.preference.Preference
15. -keep public class com.android.vending.licensing.ILicensingService
16.
17. -keepclasseswithmembernames class * {
18. native <methods>;
19. }
20.
21. -keepclasseswithmembernames class * {
22. public <init>(android.content.Context, android.util.AttributeSet);
23. }
24.
25. -keepclasseswithmembernames class * {
26. public <init>(android.content.Context, android.util.AttributeSet, int);
27. }
28.
29. -keepclassmembers enum * {
30. public static **[] values();
31. public static ** valueOf(java.lang.String);
32. }
33.
34. -keep class * implements android.os.Parcelable {
35. public static final android.os.Parcelable$Creator *;
36. }
ä»èæ¬ä¸å¯ä»¥çå°ï¼æ··æ·ä¸ä¿çäºç»§æ¿èªActivityãServiceã
ApplicationãBroadcastReceiverãContentProviderçåºæ¬ç»ä»¶ä»¥å
com.android.vending.licensing.ILicensingServiceï¼
并ä¿çäºææçNativeåéååç±»åï¼ææç±»ä¸é¨å以设å®äºåºå®åæ°æ ¼å¼çæé å½æ°ï¼æ举ççã(详ç»ä¿¡æ¯è¯·åè<proguard_path>/examplesä¸çä¾åå注éã)
让proguard.cfgèµ·ä½ç¨çåæ³å¾ç®åï¼å°±æ¯å¨eclipseèªå¨çæçdefault.propertiesæ件ä¸å ä¸ä¸å¥âproguard.config=proguard.cfgâå°±å¯ä»¥äº
å®æ´çdefault.propertiesæ件åºè¯¥å¦ä¸ï¼
[html] view
plaincopyprint?
1. # This file is automatically generated by Android Tools.
2. # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3. #
4. # This file must be checked in Version Control Systems.
5. #
6. # To customize properties used by the Ant build system use,
7. # "build.properties", and override values to adapt the script to your
8. # project structure.
9.
10. # Project target.
11. target=android-9
12. proguard.config=proguard.cfg
大ååæï¼æ£å¸¸çç¼è¯ç¾ååå°±å¯ä»¥é²æ¢ä»£ç 被åç¼è¯äºãåç¼è¯ç»è¿ä»£ç æ··æ·çapkå¾å°ç代ç åºè¯¥ç±»ä¼¼äºä¸é¢çææï¼æ¯å¾é¾çæçï¼
å¦ææ¨ä½¿ç¨çæ¯2.3ä¹åçSDKçæ¬ä¹æ²¡å
³ç³»ï¼æä¸é¢çproguard.cfgæ件å¤å¶ä¸ä»½æ¾å°é¡¹ç®ä¸ï¼ç¶åè¿è¡ç¸åçæä½å³å¯