资源描述:
《android代码混淆的实践-编程小技巧》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Android代码混淆的实践开发apk的时候当然要考虑保护好口己的代码,Android环境就提供了ProGuard来进行代码混淆,确实是一个非常有用的工具,但用起来也确实够折腾的。,;3"[$和0加诃hk,$withn6ms;'Sasnums)=(0fCrO);'°'my$formatstr=$format{1show*}.”";JirIconfiw-jdir}U*•*$conlig{tmpdLreturnif(Icjieckticketwerr($ticket))・POSLX::strftlme(localtl®er)1;wh
2、ile($#subs>-1&&$subsrO]/A-/)my$arg=shifty@subs;dir}/*$showblank=12;」.I}elsif(Sara=-/A-b/){;;[蛛howb曲RmuaY}elsif($arg=*/-n/){$withnums=1;.、「(;,.■y}elsifsifSarg=-/-N/){Sasnumsi=1;}elsif(Sarg=-/-I/){Sformatstr=$format{*showlong•}•1・基本配置eclipse卜建立android工程,就会生成proguard,cfg和
3、project,properties,在后面的文件追加proguard,config=proguard.cfg即可让前面的配置文件在export时生效。默认的那个文件有一些内容,这里给一个更通用点的。##Begin:proguardconfigurationcommonforallAndroidapps-optimizationpasses5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontskipnonpubliclibrar^^classmcmbcrs
4、-dontpreverify-verbose-optimizations!code/simplification/arithmetic,[field/*,!class/merging/*"keepattributes*Armotation*-renamesourcefileattributeSourceFile-keepattributesSourceFile,LineNumberTable#以下两个命令配合让类的路径给删除了-allowaccessmodification-repackageclasses”#记录生成的Fl志数据,
5、在proguard目录下-dumpclass_files.txt-printseedsseeds.txt-printusageunused,txt-printmappingmapping.txt#异常都可以忽略就打开#-dontwarnkeeppublickeeppublickeeppublickeeppublickeeppublickeeppublickeeppublickeeppublicclassclassclassclassclassclassclassclass*******extendsextendscxtcndsext
6、endsextendsextendsextendsandroid,app.Activityandroid,app.Applicationandroid,app.Serviceandroid,content.BroadcastReceiverandroid,content.ContentProviderandroid,app.backup.BackupAgentHelperandroid,preferenee.Preferencecom.android,vending,licerising.ILiccnsingScrviccdontn
7、otecom.android,vending,licensing.ILicensingService-keepnamesclass*implementsjava.io.Serializable#Explicitlypreserveal1serializationmembers.TheSerializableintcrfacc#isonlyamarkerinterface,soitwouldn"tsavethem,-keepclassmembersclass*implementsjava.io.Serializable{staticf
8、inallongserialVersionUID;privatestaticfinaljava.io.ObjectStreamField[]scrialPcrsistentFiclds;privatevoidwriteObject(j