android ant混淆时遇到的错误总结

E/InputDispatcher(1823): channel '41f74bb0 com.nwd.radio/com.nwd.radio.home_horizontalActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
A/libc(7625): Fatal signal 11 (SIGSEGV) at 0x0000001c (code=1), thread 7642 (com.nwd.radio)

这两个 问题也搞了我几个小时,是由于 调用jni出现的问题,但这里报的错,并不直接 。

-keep class com.acloud.newinterface.GlaNative{ *; }       使用这句话,不混淆jni代码  (这个里面有jni代码) 再使用

-keep class com.android.car.setting.home_horizontalActivity{ *; }   不混淆某个类,

指定不混淆某个方法
-keep class com.jsjjs.ReverseVerticalSeekBar{
   void onProgressRefresh(float , boolean );
  
}

不混淆某个内部类:
-keep class com.android.car.setting.ReverseVerticalSeekBar$OnSeekBarChangeListener {
    public <fields>;
    public <methods>;
}


Warning: com.acloud.newinterface.SystemInfo: can't find referenced class android.os.SystemProperties

Warning: com.acloud.newinterface.ThreeLampControlSetting: can't find referenced class android.os.Hardware
Warning: com.nwd.factory.can.CanFactorySettingUtil: can't find referenced class android.os.SystemProperties

Warning: com.nwd.factory.can.CanFactorySettingUtil: can't find referenced class android.os.SystemProperties


使用-dontwarn android.os.SystemProperties解决了问题--忽略警告



-dontwarn com.xx.bbb.**
-keep class com.xx.bbb.** { *;}

参数来保持第三方库中的类而不乱,-dontwarn和-keep 结合使用,意思是保持com.xx.bbb.**这个包里面的所有类和所有方法而不混淆,接着还叫ProGuard不要警告找不到com.xx.bbb.**这个包里面的类的相关引用。
配置好后,重新打包,一切OK!而且程序能正确运行


下面是我工作项目中的一个配置可以参考一下:

-optimizationpasses 5  
-dontusemixedcaseclassnames  
-dontskipnonpubliclibraryclasses  
-dontpreverify   
-verbose  
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*  
 
-keepattributes *Annotation*  
-keepattributes Signature  
 
 
-libraryjars libs/Android_Utils_V1.0.0.jar
-libraryjars libs/android-support-v4.jar  
-libraryjars libs/com.acloud.sdkbase.jar
-libraryjars libs/IKernelLib_V0.0.1.jar
-libraryjars libs/QtAndroid-bundled.jar
-libraryjars libs/SettingLib_V0.0.1.jar
-libraryjars libs/FactoryDefineLib.jar
-libraryjars libs/VoiceAnalyzeLib.jar

 
-keep class com.baidu.** { *; }   
-keep class vi.com.gdi.bgl.android.**{*;}  
 
-keep public class * extends android.app.Fragment    
-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 * extends android.support.v4.**  
-keep public class com.android.vending.licensing.ILicensingService  
 
-keep class com.google.gson.stream.** { *; }  
-keep class com.google.gson.examples.android.model.** { *; }  
-keep class com.uuhelper.Application.** { *; }  
-keep class net.sourceforge.zbar.** { *; }  
-keep class com.google.android.gms.** { *; }   
   
   
-keep class com.android.vending.licensing.ILicensingService  
-keep class android.support.v4.** { *; }    
-keep class org.apache.commons.net.** { *; }    
   
 
-dontwarn android.support.v4.**  
-dontwarn com.nwd.kernel.source.rule.**  
-dontwarn com.nwd.kernel.utils.AckHelper
-dontwarn com.nwd.kernel.source.ProtocalUtil
-dontwarn com.nwd.kernel.source.MCUSettings
-dontwarn org.apache.commons.net.**   
-dontwarn android.os.SystemProperties
-dontwarn android.os.Environment
-dontwarn android.os.Hardware
-dontwarn com.nwd.factory.service.FactorySettingService

-keepclasseswithmembernames class * {  
    native <methods>;  
}  
 
-keepclasseswithmembernames class * {  
    public <init>(android.content.Context, android.util.AttributeSet);  
}  
 
-keepclasseswithmembernames class * {  
    public <init>(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 *;  
}  
 
-keepclasseswithmembers class * {  
    public <init>(android.content.Context);  
}  
 
-dontshrink  
-dontoptimize  
-dontwarn com.google.android.maps.**  
-dontwarn android.webkit.WebView  
-dontwarn com.android.utils.**
-dontwarn com.tencent.weibo.sdk.**  
-dontwarn com.facebook.**  
-dontwarn com.nwd.kernel.utils.MountCheckUtil
 
-keepattributes Exceptions,InnerClasses,Signature  
-keepattributes *Annotation*  
 

-keep public class javax.**  
-keep public class android.webkit.**  
 
-keep class com.facebook.**  
-keep public class com.tencent.** {*;}  
 
-keep public class [com.nwd.radio].R$*{  
    public static final int *;  


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值