4

I have this Warning when building my code in Android Studio.
Few times they don't show up, but most of the times they do.

warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

I've read other issues and included these in my proguard file:

-keepattributes EnclosingMethod
-keepattributes InnerClasses

However they didn't help.

Edit:

If it's not possible to solve this, please tell me how to hide this warning in postguard (or any other way). Thank you!

Dombi Bence
  • 746
  • 7
  • 23
  • Hi, did you saw this? http://stackoverflow.com/questions/30999337/android-studio-and-gradle – Jaco Nov 08 '16 at 12:43
  • Hi. No I didn't but that's not relevant. It didn't help. Please remove the down vote from my questions so I can get answers here. Thanks! – Dombi Bence Nov 14 '16 at 13:15
  • Sorry György Benedek, I didn't add you the down vote – Jaco Nov 14 '16 at 13:49
  • Oh. I see. Then sorry for the accusation and thank you for your note! :) – Dombi Bence Nov 15 '16 at 09:30
  • If you included some code it would help solve the problem. In the manner you have posted this question it is a bit of a guessing game –  Nov 28 '16 at 13:17
  • My program is about 100.000 lines of code. As the error doesn't say anything about where the error is, I can only rely on other people with the same error code, who found out the answer. – Dombi Bence Nov 29 '16 at 08:51

2 Answers2

2

Whats causes the problem?

You are trying to use a class file not compiled against Java 6 or 7 in a JVM that runs Android's runtime Dalvik. It's not a big issue, you dont have to worry.

How can I fix it?

You can recompile the library that is causing the issue. Unfortunately, the library is in a compiled jar already. You can try to look for its source online and then compile that

Niza Siwale
  • 2,390
  • 1
  • 18
  • 20
  • I'm only using one jar, and that's dnsjava. https://sourceforge.net/projects/dnsjava/ Can this cause the issue? There is no newer version, as I see, I already use the 2.1.7. Is there a possible option in postguard to hide this warning? – Dombi Bence Nov 28 '16 at 11:51
  • The Jnamed in dnsjava is causing the issue. If you look at its source http://dnsjava.org/dnsjava-current/jnamed.java it states that it was created in 2004. Create a package called org.xbill.DNS.programs in your project and a class called Jnamed in that package with the code from the source. That should fix the issue – Niza Siwale Nov 29 '16 at 10:23
  • The fix didn't work, however you found the source of the warning. Thank you, I give you the bounty! :) – Dombi Bence Nov 29 '16 at 14:31
  • 1
    Thank you. Maybe try to import the project from github https://github.com/ieugen/dnsjava rather than using the jar. That way, it will be recompiled – Niza Siwale Nov 29 '16 at 14:53
  • Yeah, the exact same idea came to my mind too. :) And it worked. :) Thank you again for you assistance! :) – Dombi Bence Nov 29 '16 at 14:57
  • You're György, gland I could help. Thanks for the bounty too! – Niza Siwale Nov 29 '16 at 15:04
2

Have you considered updating your JDK, and JRE? Also, have you updated Android studio to the latest version? Doing either of these tasks may solve the problem. Also uninstalling and reinstalling proguard in the sdk manger may help.

  • Android Studio is up to date, and I always install recommended updated that pop up at start. I'm using Android Studio on 3 different computers and all have the problem, so probably this won't work, but I will give it a try, thank you! :) – Dombi Bence Nov 29 '16 at 09:05