Error: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive

最近在编译Android项目的时候,报告如下错误:

网上查找了很久,才了解到问题出在混淆配置上,具体原因为当混淆配置项中存在

的时候,需要同步增加

更详细的解释参考如下:

Signature (Java 8 or higher) works only Java 8 or higher and InnerClasses (Java 5 or higher) so check your Android Studio is using Java SDK version. Please update your Proguard config with below settings

Add this line to your proguard-rules.pro file:

InnerClasses (Java 5 or higher)

Specifies the relationship between a class and its inner classes and outer classes. Other than this and the naming convention with a '$' separator between the names of inner classes and outer classes, inner classes are just like ordinary classes. Compilers may need this information to find classes referenced in a compiled library. Code may access this information by reflection, for instance to derive the simple name of the class.

Signature (Java 8 or higher)

Specifies the generic signature of the class, field, or method. Compilers may need this information to properly compile classes that use generic types from compiled libraries. Code may access this signature by reflection.

More details about -keepattributes and more settings you can apply, please see below link.

Proguard options

参考链接


Android Build Error: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive

发布者

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注