问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

Android-android 怎么实现只混淆自己的代码,而不混淆第3方jar包_百度...

发布网友 发布时间:2022-04-30 16:07

我来回答

2个回答

热心网友 时间:2022-04-20 10:31

  为了解决第三方包不被混淆,第三方包在混淆后,运行的时候会挂掉。我的错误是java.lang.ExceptionInInitializerError

[java] E/AndroidRuntime( 9608):
java.lang.ExceptionInInitializerError
E/AndroidRuntime( 9608): at
a.a.b.f.<init>(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.b.e.<init>(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.dg.b(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.dg.a(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.b.a(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.ad.a(Unknown Source)

  ………………………………………………………………………………中间部分省略
  最终我通过 加LOG的调试方法定位到是由于第三方jar包被混淆后的原因导致的。

  解决方法:
  在proguard-android.txt文件最后加入了-keep class org.jsoup.**这样一句代码,就是保持这个类不被混淆

  附上proguard-android.txt源文件

  

  [html] # This is a configuration file for ProGuard.
  # http://proguard.sourceforge.net/index.html#manual/usage.html
  
  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -verbose
  
  # Optimization is turned off by default. Dex does not like code run
  # through the ProGuard optimize and preverify steps (and performs some
  # of these optimizations on its own).
  -dontoptimize
  -dontpreverify
  # Note that if you want to enable optimization, you cannot just
  # include optimization flags in your own project configuration file;
  # instead you will need to point to the
  # "proguard-android-optimize.txt" file instead of this one from your
  # project.properties file.
  
  -keepattributes *Annotation*
  -keep public class com.google.vending.licensing.ILicensingService
  -keep public class com.android.vending.licensing.ILicensingService
  
  # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
  -keepclasseswithmembernames class * {
  native <methods>;
  }
  
  # keep setters in Views so that animations can still work.
  # see http://proguard.sourceforge.net/manual/examples.html#beans
  -keepclassmembers public class * extends android.view.View {
  void set*(***);
  *** get*();
  }
  
  # We want to keep methods in Activity that could be used in the XML attribute onClick
  -keepclassmembers class * extends android.app.Activity {
  public void *(android.view.View);
  }
  
  # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
  -keepclassmembers enum * {
  public static **[] values();
  public static ** valueOf(java.lang.String);
  }
  
  -keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
  }
  
  -keepclassmembers class **.R$* {
  public static <fields>;
  }
  
  # The support library contains references to newer platform versions.
  # Don't warn about those in case this app is linking against an older
  # platform version. We know about them, and they are safe.
  -dontwarn android.support.**
  
  -keep class org.jsoup.**

  # This is a configuration file for ProGuard.
  # http://proguard.sourceforge.net/index.html#manual/usage.html

  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -verbose

  # Optimization is turned off by default. Dex does not like code run
  # through the ProGuard optimize and preverify steps (and performs some
  # of these optimizations on its own).
  -dontoptimize
  -dontpreverify
  # Note that if you want to enable optimization, you cannot just
  # include optimization flags in your own project configuration file;
  # instead you will need to point to the
  # "proguard-android-optimize.txt" file instead of this one from your
  # project.properties file.

  -keepattributes *Annotation*
  -keep public class com.google.vending.licensing.ILicensingService
  -keep public class com.android.vending.licensing.ILicensingService

  # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
  -keepclasseswithmembernames class * {
  native <methods>;
  }

  # keep setters in Views so that animations can still work.
  # see http://proguard.sourceforge.net/manual/examples.html#beans
  -keepclassmembers public class * extends android.view.View {
  void set*(***);
  *** get*();
  }

  # We want to keep methods in Activity that could be used in the XML attribute onClick
  -keepclassmembers class * extends android.app.Activity {
  public void *(android.view.View);
  }

  # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
  -keepclassmembers enum * {
  public static **[] values();
  public static ** valueOf(java.lang.String);
  }

  -keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
  }

  -keepclassmembers class **.R$* {
  public static <fields>;
  }

  # The support library contains references to newer platform versions.
  # Don't warn about those in case this app is linking against an older
  # platform version. We know about them, and they are safe.
  -dontwarn android.support.**

  -keep class org.jsoup.**

热心网友 时间:2022-04-20 11:49

proguard keep 后面佳第三方jar包类名 可以防止混淆
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
临沂比较有名的男装品牌 呼伦贝尔市悦动网络科技有限公司怎么样? 呼伦贝尔中汇实业有限公司怎么样? 呼伦贝尔油玉不绝电子商务有限公司怎么样? 如何避免wps卡顿? 属鼠的男人找对象是属什么,属鼠的人和什么属相合 96年鼠的姻缘在哪年 属相相合年份运势提升 2024属鼠找对象属什么最佳 黑客攻击网站能报案吗 黑客攻击报案有用吗 seetong监控怎么注销账号 这本书怎么写读后感 2万内的,皮带的女士手表求推荐 android代码混淆以及怎么判断一个apk代码是否被混淆过 哪本书读后感好写,就是感悟特多的那种。 职业药师在什么时间报名,需要什么证件 如何混淆android代码以及注意事项 稻草人这本书的读后感 我想买一个2万左右的女士手表,帮忙说一下 《人生》这本书怎么样,《人生》读后感 药剂师需要什么条件才能考 欢喜自在这本书的读后感 2万左右的女士手表,选哪个牌子,哪款好些 读一本好书的心得体会,需要二千字的文章如钢铁是怎样炼成的这本书的读后感 专业网贷技术哪里有 分享《中国活法》读后感吧 中国人事考试网2017年执业药师考试报考条件有哪些要求 读完一本书的读后感 这本书读后感。 这本书的读后感,400字左右 关于Android studio 怎么使用代码混淆的问题 android studio 代码混淆错误 萤石云摄像头怎么删除原账号 监控摄像头不用了如何注销 android如何将混淆代码还原? 爱维宝贝监控机如何注销掉之前帐户 Android如何保持指定类不被混淆? 请问在房管局申请注销监控账户时需要提交什么资料。最好有一份资料清单,谢谢。 摄像头用户怎么注销? android中哪些东西不能做代码混淆 android代码混淆时,如何防止第三方jar包被 监控摄像头注销帐户就是解绑吗? 监控器账户注销了怎么恢复? 开发商监控账户在什么情况下可以取消? 一个人没有固定的朋友,是自己的问题吗? 如果一个人没有朋友,正常吗 怎么注销萤石云原账号? 一个人混到最后发现,自己没有一个朋友,到底正不正常? 大拿监控手机怎么注销用户? 一个人好朋友很少正常吗?为什么?