資源描述:
《Android如何防止apk程序被反編譯.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、個(gè)人收集整理勿做商業(yè)用途作為Android應(yīng)用開(kāi)發(fā)者,不得不面對(duì)一個(gè)尷尬的局面,就是自己辛辛苦苦開(kāi)發(fā)的應(yīng)用可以被別人很輕易的就反編譯出來(lái)。Google似乎也發(fā)現(xiàn)了這個(gè)問(wèn)題,從SDK2.3開(kāi)始我們可以看到在android-sdk-windowstools下面多了一個(gè)proguard文件夾proguard是一個(gè)java代碼混淆的工具,通過(guò)proguard,別人即使反編譯你的apk包,也只會(huì)看到一些讓人很難看懂的代碼,從而達(dá)到保護(hù)代碼的作用。下面具體說(shuō)一說(shuō)怎么樣讓SDK2.3下的proguard.cfg文件起作用,先來(lái)看看android-sdk-windowstoolsl
2、ibproguard.cfg的內(nèi)容:[html]?。觯椋澹鱬laincopyprint?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.
3、Activity??9.-keep?public?class?*?extends?android.app.Applicat(yī)ion??10.-keep?public?class?*?extends?android.app.Service??11.-kee(cuò)p?public?class?*?extends?android.content.BroadcastReceiver??12.-keep?public?class?*?extends?android.content.ContentProvider??13.-keep?public?class?*?extends?android
4、.app.backup.BackupAgentHelper??14.-keep?public?class?*?extends?android.preference.Preference??15.-keep?public?class?com.a(chǎn)ndroid.vending.licensing.ILicensingService??16.??17.-keepclasseswithmembernames?class?*?{??18.????native?;??19.}??20.??21.-keepclasseswithmembernames?class?*?{?
5、?22.????public?6、??9.????public?static?**?valueOf(java.lang.String);??10.}??11.??12.-kee(cuò)p?class?*?implements?android.os.Parcelable?{??13.??public?stat(yī)ic?final?android.os.Parcelable$Creat(yī)or?*;??14.}??從腳本中可以看到,混淆中保留了繼承自Activity、Service、Applicat(yī)ion、BroadcastReceiver、 ContentProvider等基本組件以及com.android.vending.
7、licensing.ILicensingService,并保留了所有的Nat(yī)ive變量名及類名,所有類中部分以設(shè)定了固定參數(shù)格式的構(gòu)造函數(shù),枚舉等等。(詳細(xì)信息請(qǐng)參考