問題描述
我正在嘗試將現有的 SDK 硬塞到 android 設備上,并且所述 SDK 的依賴項之一是 Apache log4j.我能夠將我的測試程序加載到 android 模擬器上,但是當調用 log4j 對象PropertySetter"時,程序失敗并出現驗證異常.有沒有辦法改善這個問題?
I am attempting to shoehorn an existing SDK onto an android device and one of the dependencies of said SDK is Apache log4j. I am able to load my test program onto the android emulator but when the log4j object "PropertySetter" is called the program fails with a verification exception. Is there a way to ameliorate this issue?
推薦答案
實際上使用 slf4j 對我來說是一個非常輕松的過程,而且這似乎很常見,至少對于使用直接 log4j 功能的庫來說是這樣.您實際上不需要將 slf4j 換成 log4j,只需將兩個 slf4j 庫從 http:/添加到您的項目中/www.slf4j.org/download.html:
Actually using slf4j turned out a remarkably painless process for me, and it seems the common case, at least for libraries that use straightforward log4j features. You don't really need to swap slf4j in for log4j, only add two slf4j libraries to your project from http://www.slf4j.org/download.html:
-- Android 的 slf4j 庫(目前為 slf4j-android-1.6.1-RC1.jar)
-- slf4j 之上的 log4j (http://www.slf4j.org/legacy.html#log4j-over-slf4j) 橋接器.
-- the slf4j library for Android (currently slf4j-android-1.6.1-RC1.jar)
-- the log4j over slf4j (http://www.slf4j.org/legacy.html#log4j-over-slf4j) bridge.
后者定義了典型實現使用的核心 log4j 類,并將它們綁定到 slf4j Android 實現.添加庫后,代碼就可以工作了.
The latter defines the core log4j classes used by typical implementations and bind them to the slf4j Android implementation. Once the libraries are added the code works.
這篇關于Android 中的 log4j 支持的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!