• android app的 混淆打包,详细教程见app混淆打包教程
  • 根据以上的教程,我也给我的app做了一个混淆打包,反编译之后,发现的确混淆成功,并且运行正常。
  • 我的app里面的代码比较简单,用到了第三方jar只有gson.
  • 于是我的proguard-project.txt是这样的:
# To enable ProGuard in your project, edit project.properties# to define the proguard.config property as described in that file.## Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in ${sdk.dir}/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the ProGuard# include property in project.properties.## For more details, see#   http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.javascript.interface.for.webview {#   public *;#}#######################################################################gson################## -libraryjars libs/gson-2.2.1.jar-keep class com.google.gson.** {*;}  -keep class sun.misc.Unsafe { *; }  -keep class com.google.gson.stream.** { *; }  -keep class com.google.gson.examples.android.model.** { *; }   -keep class com.google.** {      ;      ;  }  -keepclassmembers class * implements java.io.Serializable {      static final long serialVersionUID;      private static final java.io.ObjectStreamField[] serialPersistentFields;      private void writeObject(java.io.ObjectOutputStream);      private void readObject(java.io.ObjectInputStream);      java.lang.Object writeReplace();      java.lang.Object readResolve();  }  -dontwarn com.google.gson.**  ################common###############  -keep class com.duck.smsCHeck.bean.** {*;}
  • 我的project.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 edit# "ant.properties", and override values to adapt the script to your# project structure.## To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt# Project target.target=android-20android.library.reference.1=../appcompat_v7
  • 只有这两个文件配置好了,然后就是右键导出为android app。一路next,添加或生成一个keystore文件这样就生成了一个混淆过的apk文件。


  • 附上我的导出之后的工程。导出之后的工程

  • 顺便介绍一下工程的内容。主要是我之前的一个需求:短信验证的校验。
    • 主要逻辑:发送请求给第三方平台(我这里用的是云之讯),然后,请求正确,手机就会收到一个验证码短信。读取该短信,判断其中验证码与生成的验证码是否相同,如果相同,验证通过。其他任何情况,验证不通过。然后,删除该验证码短信。(5.0以后的手机不能完成这一步).
    • 里面的代码就不解释了,和上一篇相同。这里只是在之前的工程的基础上做了一个混淆打包。
    • 关于如何将部分java代码导出生成混淆过的jar,这个还没有弄过,在搜索中…..

更多相关文章

  1. Android微信分享,无响应
  2. 关于 unity5.3.1 录制 animation 带有 rotation 信息打包 Androi
  3. Android开发者指南(9) —— ProGuard
  4. 【分享】Android二次打包植入广告
  5. 在 Android(安卓)studio 中 配置Gradle 根据不同参数打包,并在代
  6. android studio 打包报 MissingTranslation 的 3种解决方式
  7. Android(安卓)混淆代码总结 和 Android(安卓)APK反编译(最新更新
  8. Jenkins奇技淫巧 — Python打包篇(Android自动化构建)
  9. android文件导出错误—— failed to pull a selection

随机推荐

  1. 对不起,这局我要赢!!!
  2. 想要成为一名优秀的Java程序员,你需要这8
  3. 为什么一定要和靠谱的人在一起???
  4. Django 博客单元测试:测试评论应用
  5. 面试被问尾递归优化知道怎么做吗?
  6. 万能码从基本到不断完善(安全扫码专业委员
  7. Element Plus组件-按钮、图标、ColorPick
  8. 咋嘞?你的IDEA过期了吧!加个Jar包就破解了,
  9. 来吧,一文彻底搞懂Java中的Comparable和Co
  10. 你知道 JavaScript Symbol 类型是什么,怎