Android Ant打包打入第三方包报错解决方案

在做项目的时候,使用到第三方包,在混淆打包的时候一直报第三方包的warning, 导致最后BUILD FAIL. 部分warn信息

[proguard] Warning: android.support.v4.view.accessibility.AccessibilityManagerCompatIcs$1: can't find superclass or interface android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener
 [proguard] Warning: android.support.v4.view.accessibility.AccessibilityEventCompatIcs: can't find referenced method 'int getRecordCount()' in class android.view.accessibility.AccessibilityEvent
 [proguard] Warning: android.support.v4.view.accessibility.AccessibilityEventCompatIcs: can't find referenced class android.view.accessibility.AccessibilityRecord
 [proguard] Warning: android.support.v4.view.accessibility.AccessibilityEventCompatIcs: can't find referenced method 'void appendRecord(android.view.accessibility.AccessibilityRecord)' in class android.view.accessibility.AccessibilityEvent
 [proguard] Warning: android.support.v4.view.accessibility.AccessibilityEventCompatIcs: can't find referenced method 'android.view.accessibility.AccessibilityRecord getRecord(int)' in class android.view.accessibility.AccessibilityEvent
 [proguard] Warning: android.support.v4.view.accessibility.AccessibilityNodeInfoCompatIcs: can't find referenced class android.view.accessibility.AccessibilityNodeInfo
 

几经折腾,终于找到有效的方法。

根据上面的warning信息

打开proguard.cfg,加入-dontwarn android.support.v4.view.accessibility.*

如果还有其他警告,一个个加入即可。

也可以直接加入 -dontwarn

保存,再次打包即可

相关推荐