-->

NewRelic causing build errors

2019-06-06 22:42发布

问题:

After adding the NewRelic sdk to my android project, every time i try to build for release, i get this really long warning/error on the gradle console which also impacts build time; the project now takes twice as long to build.

27t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.b.v) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.b.x) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.c.b) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.c.c) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.c.d) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.c.e) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.c.k) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"simple","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"simple","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"simple","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"simple","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"simple","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"simple","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"simple","text":"(c.a.a.a.a.d.e) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"simple","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}

I made sure to include newrelic in my proguard file and expected such warnings to be ignored.

回答1:

Your proguard config should look like:

-keep class com.newrelic.** { *; }

-dontwarn com.newrelic.**

-keepattributes Exceptions, Signature, InnerClasses