Android如何防止apk程序被反編譯
操作方法
(01)作爲Android應用開發者,不得不面對一個尷尬的局面,就是自己辛辛苦苦開發的應用可以被別人很輕易的就反編譯出來。Google似乎也發現了這個問題,從SDK2.3開始我們可以看到在android-sdk-windowstools下面多了一個proguard文件夾proguard是一個java代碼混淆的工具,通過proguard,別人即使反編譯你的apk包,也只會看到一些讓人很難看懂的代碼,從而達到保護代碼的作用。下面具體說一說怎麼樣讓SDK2.3下的文件起作用,先來看看android-sdk-windowstoolslib的內容:[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 vity 9.-keep public class * extends ication 10.-keep public class * extends ice 11.-keep public class * extends dcastReceiver 12.-keep public class * extends entProvider 13.-keep public class * extends upAgentHelper 14.-keep public class * extends erence 15.-keep public class ensingService 16. 17.-keepclasseswithmembernames class * { 18. native <methods>; 19.} 20. 21.-keepclasseswithmembernames class * { 22. public <init>(ext, ibuteSet); 23.} 24. 25.-keepclasseswithmembernames class * { 26. public <init>(ext, ibuteSet, int); 27.} 28. 29.-keepclassmembers enum * { 30. public static **[] values(); 31. public static ** valueOf(ng); 32.} 33. 34.-keep class * implements elable { 35. public static final elable$Creator *; 36.} -optimizationpasses 5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontpreverify-verbose-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*-keep public class * extends vity-keep public class * extends ication-keep public class * extends ice-keep public class * extends dcastReceiver-keep public class * extends entProvider-keep public class * extends upAgentHelper-keep public class * extends erence-keep public class ensingService-keepclasseswithmembernames class * { native <methods>;}-keepclasseswithmembernames class * { public <init>(ext, ibuteSet);}-keepclasseswithmembernames class * { public <init>(ext, ibuteSet, int);}-keepclassmembers enum * { public static **[] values(); public static ** valueOf(ng);}-keep class * implements elable { public static final elable$Creator *;}從腳本中可以看到,混淆中保留了繼承自Activity、Service、Application、BroadcastReceiver、ContentProvider等基本組件以及ensingService,並保留了所有的Native變量名及類名,所有類中部分以設定了固定參數格式的構造函數,枚舉等等。(詳細信息請參考<proguard_path>/examples中的例子及註釋。)讓起作用的做法很簡單,就是在eclipse自動生成的erties文件中加上一句“ig=”就可以了完整的erties文件應該如下:[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.# "erties", and override values to adapt the script to your 8.# project structure. 9. 10.# Project target. et=android-9 ig= # This file is automatically generated by Android Tools.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file must be checked in Version Control Systems.## To customize properties used by the Ant build system use,# "erties", and override values to adapt the script to your# project structure.# Project et=ig=大功告成,正常的編譯簽名後就可以防止代碼被反編譯了。反編譯經過代碼混淆的apk得到的代碼應該類似於下面的效果,是很難看懂的:如果您使用的是2.3之前的SDK版本也沒關係,把上面的文件複製一份放到項目中,然後進行相同的操作即可。
-
二十歲的某一天歌詞意思
《二十歲的某一天》是花粥專輯的第一首單曲,也是花粥幾年前最早被聽衆熟知的一系列歌曲之一。天橋邊的男女花五塊錢吃了一碗牛肉麪,然後故事會有怎樣?且聽花粥不動聲色娓娓道來。操作方法(01)花粥的歌,清新慵懶。二十歲的某一天,是其早期作品之一。其歌詞如下:20歲的某...
-
人民幣符號怎麼打¥ word插入人民幣符號?
人民幣符號怎麼打?我們在工作的時候,有時候需要在電腦上輸入“¥”這個人民幣符號,然而很多用戶不知道該怎麼輸入,這給工作帶來了很大的不便。其實人民幣符號的輸入方法很簡單,下面小編給大家介紹幾種輸入方法。操作方法(01)使用輸入法工具在中文狀態下,使用Shift+$/4鍵,...
-
微信openid獲取教程
用微信支付平臺發放紅包必須上傳用戶的微信openid,想要導出微信openid可以按以下步驟來做。操作方法(01)進入微信openid導出平臺,根據下圖1更新列表;2刷新粉絲信息;3導出數據;(02)獲得的微信平臺openid數據如下(03)把openid拷貝到t型臺文件裏,格式如下。(04)導入到微信商戶平...
-
谷歌瀏覽器語言設置,谷歌瀏覽器如何更改語言
谷歌瀏覽器語言怎麼設置,谷歌瀏覽器如何更改語言。雖然在國內,大多數人也都是用中文,但也不有少英語愛好者喜歡用外語,那麼下面我就來說下谷歌瀏覽器語言怎麼設置,谷歌瀏覽器如何更改語言。操作方法(01)首先點擊打開GoogleChrome瀏覽器。(02)點擊打開後,進入到我們最爲習...