Lint finds warnings in log4j used in Android project

I am using log4j in an Android project, a dependency defined in the gradle project as:

compile 'log4j:log4j:1.2.16'

When the Lint check occurs, the analyzer reports InvalidPackage errors:

../../../../../../../. Gradle / caches / modules-2 / files-2.1 / log4j / log4j / 1.2.17 / 5af35056b4d257e4b64b9e8069c0746e8b08629f / log4j-1.2.17.jar: invalid package reference in the library; not included in Android: java.awt. Link from org.apache.log4j.chainsaw.ControlPanel ... /../../../../../../.gradle/caches/modules-2/files-2.1/log4j/log4j/ 1.2.17 / 5af35056b4d257e4b64b9e8069c0746e8b08629f / log4j-1.2.17. jar: invalid package reference in the library; not included in Android: java.awt.event. Link to org.apache.log4j.chainsaw.Main. 1.

....

How can I fix this better? Lint suggests suppressing this warning by id, but that means suppressing all warnings by type, am I right? This doesn't seem to be the best solution ... Maybe some way to tell lint not to check the log4j package?

+4
source share
1 answer

itself is not supported on Android.

Instead, use your own Android graphics, as described in How to add the java.awt.image package to Android and other issues like 25488832: using-awt-classes-in -android

Of course, this helps a little if you rely on a library that relies on awt. Perhaps there is an Android version of such a library.

(, , . , awt, RTE. Lint. , .)

0

Source: https://habr.com/ru/post/1545055/


All Articles