Proguard打包混淆报错:can't find superclass or interface

Proguard打包混淆报错:can't find superclass or interface

 

在Eclipse打包工程时报如下错误:

 

[2014-01-06 08:58:44 - emp_android] Proguard returned with error code 1. See console

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.b$a: can't find superclass or interface android.location.GpsStatus$NmeaListener

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced method 'int getLac()' in class android.telephony.NeighboringCellInfo

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.APS: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.e: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.e: can't find referenced method 'void onSignalStrengthsChanged(android.telephony.SignalStrength)' in class android.telephony.PhoneStateListener

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.e: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.e: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.i: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.i: can't find referenced method 'void onSignalStrengthsChanged(android.telephony.SignalStrength)' in class android.telephony.PhoneStateListener

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.i: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.autonavi.aps.api.i: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.b: can't find referenced method 'boolean addNmeaListener(android.location.GpsStatus$NmeaListener)' in class android.location.LocationManager

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.b: can't find referenced method 'void removeNmeaListener(android.location.GpsStatus$NmeaListener)' in class android.location.LocationManager

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.b: can't find referenced class android.location.GpsStatus$NmeaListener

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.b$a: can't find referenced class android.location.GpsStatus$NmeaListener

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c: can't find referenced class android.telephony.cdma.CdmaCellLocation

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c$a: can't find referenced method 'int getLac()' in class android.telephony.NeighboringCellInfo

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c$b: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c$b: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c$b: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.baidu.location.c$b: can't find referenced class android.telephony.SignalStrength

[2014-01-06 08:58:44 - emp_android] Warning: com.lakala.b.b$2: can't find referenced method 'boolean isWiredHeadsetOn()' in class android.media.AudioManager

[2014-01-06 08:58:44 - emp_android] Warning: com.lingtu.mapapi.MapView: can't find referenced method 'int getPointerCount()' in class android.view.MotionEvent

[2014-01-06 08:58:44 - emp_android]       You should check if you need to specify additional program jars.

[2014-01-06 08:58:44 - emp_android] Warning: there were 20 unresolved references to classes or interfaces.

[2014-01-06 08:58:44 - emp_android]          You may need to specify additional library jars (using '-libraryjars').

[2014-01-06 08:58:44 - emp_android] Warning: there were 8 unresolved references to program class members.

[2014-01-06 08:58:44 - emp_android]          Your input classes appear to be inconsistent.

[2014-01-06 08:58:44 - emp_android]          You may need to recompile them and try again.

[2014-01-06 08:58:44 - emp_android]          Alternatively, you may have to specify the option 

[2014-01-06 08:58:44 - emp_android]          '-dontskipnonpubliclibraryclassmembers'.

[2014-01-06 08:58:44 - emp_android] java.io.IOException: Please correct the above warnings first.

[2014-01-06 08:58:44 - emp_android]at proguard.Initializer.execute(Initializer.java:321)

[2014-01-06 08:58:44 - emp_android]at proguard.ProGuard.initialize(ProGuard.java:211)

[2014-01-06 08:58:44 - emp_android]at proguard.ProGuard.execute(ProGuard.java:86)

[2014-01-06 08:58:44 - emp_android]at proguard.ProGuard.main(ProGuard.java:492)


 

 

大体意思是找不到相关的类或者方法,因为工程引入了第三方包,混淆的时候如果把第三方包也混淆了,那么相关的类在使用这些包的时候就会找不到相关方法。

因此在proguard.cfg加上以下代码:

 

[html]   view plain copy 在CODE上查看代码片 派生到我的代码片
  1. -dontwarn com.baidu.**  
  2. -keep class com.baidu.** { *;}  
  3.   
  4. -dontwarn com.lakala.**  
  5. -keep class com.lakala.** { *;}  
  6.   
  7. -dontwarn com.lingtu.**  
  8. -keep class com.lingtu.** { *;}  
  9.   
  10. -dontwarn com.autonavi.**  
  11. -keep class com.autonavi.** { *;}  

 

          其实找不到引用的这个类是第三方包里面的,而且很多时候我们只需要打乱自己的代码就行了,第三方包的代码就是否要打乱就不要管了。我们可以使用

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值