多语言展示
当前在线:441今日阅读:27今日分享:41

Android apk加固加密防破解方案

Android apk加固加密防破解。作为Android应用apk开发者,不得不面对一个尴尬的局面,就是自己辛辛苦苦开发的Android apk可以被别人很轻易的就反编译出来。既然有了这个尴尬,就得有反破解的方法,爱加密小编教给大家Android apk加固加密防破解方案。
方法/步骤
1

Android apk加固加密防破解方案之混淆,proguard是一个java代码混淆的工具,通过proguard,别人即使反编译你的apk包,也只会看到一些让人很难看懂的代码,从而达到保护代码的作用。下面具体说一说怎么样让SDK2.3下的proguard.cfg文件起作用,先来看看android-sdk-windows\tools\lib\proguard.cfg的内容:

2

-optimizationpasses 5  -dontusemixedcaseclassnames  -dontskipnonpubliclibraryclasses  -dontpreverify  -verbose  -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

3

-keep public class * extends android.app.Activity  -keep public class * extends android.app.Application  -keep public class * extends android.app.Service  -keep public class * extends android.content.BroadcastReceiver  -keep public class * extends android.content.ContentProvider  -keep public class * extends android.app.backup.BackupAgentHelper  -keep public class * extends android.preference.Preference  -keep public class com.android.vending.licensing.ILicensingService    -keepclasseswithmembernames class * {      native ;  }    -keepclasseswithmembernames class * {      public (android.content.Context, android.util.AttributeSet);  }    -keepclasseswithmembernames class * {      public (android.content.Context, android.util.AttributeSet, int);  }    -keepclassmembers enum * {      public static **[] values();      public static ** valueOf(java.lang.String);  }    -keep class * implements android.os.Parcelable {    public static final android.os.Parcelable$Creator *;  }

5

完整的default.properties文件应该如下:# 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,  # 'build.properties', and override values to adapt the script to your  # project structure.    # Project target.  target=android-9  proguard.config=proguard.cfg

6

大功告成,正常的编译签名后就可以防止代码被反编译了。Android apk加固加密防破解方案反编译经过代码混淆的apk得到的代码应该类似于下面的效果,是很难看懂的:如果您使用的是2.3之前的SDK版本也没关系,把上面的proguard.cfg文件复制一份放到项目中,然后进行相同的操作即可

7

代码混淆是代码安全保护的最基础的解决方案之一,在代码混淆的基础上,进行Android apk加固加密,可以在混淆的基础上再次达到防破解的目的!在此方面可以寻求第三方服务商爱加密的Android apk加固加密解决方案。

推荐信息