[slf4j-user] Problem with SLF4J and Android

Chad La Joie chad.lajoie at switch.ch
Sat Jul 11 11:25:01 CEST 2009


I don't know anything about Android, but in cases like this, with a 
standard Java app, I would suggest the following:

- grab the SLF4J jars from the actual maintainer's site and test with 
them as a way to verify that the product shipping with the jar didn't 
make some sort of custom change

- ensure that no other version of the jar are on the classpath (for 
example, because they shipped with another application that is also 
being run)

Max Braun wrote:
> Does someone have an idea where I could go from here?
> 
> Am 03.07.2009 um 15:27 schrieb Max Braun:
> 
>> I put your code in a basic Android project using slf4j-api-1.5.6.jar 
>> and slf4j-jdk14-1.5.6.jar from openrdf-sesame-2.3-pr1-sdk.zip. The 
>> error is the same that I got before:
>>
>> I/dalvikvm(  715): DexOpt: access denied from 
>> Lorg/slf4j/LoggerFactory; to field 
>> Lorg/slf4j/impl/StaticLoggerBinder;.SINGLETON
>> W/dalvikvm(  715): VFY: unable to resolve static field 59 (SINGLETON) 
>> in Lorg/slf4j/impl/StaticLoggerBinder;
>> W/dalvikvm(  715): VFY:  rejecting opcode 0x62 at 0x0006
>> W/dalvikvm(  715): VFY:  rejected 
>> Lorg/slf4j/LoggerFactory;.getSingleton 
>> ()Lorg/slf4j/impl/StaticLoggerBinder;
>> W/dalvikvm(  715): Verifier rejected class Lorg/slf4j/LoggerFactory;
>> D/AndroidRuntime(  715): Shutting down VM
>> W/dalvikvm(  715): threadid=3: thread exiting with uncaught exception 
>> (group=0x4000fe70)
>> E/AndroidRuntime(  715): Uncaught handler: thread main exiting due to 
>> uncaught exception
>> E/AndroidRuntime(  715): java.lang.VerifyError: org.slf4j.LoggerFactory
>> E/AndroidRuntime(  715):     at 
>> de.unikoblenz.isweb.csxpoi.slf4jtest.SLF4JTest.onCreate(SLF4JTest.java:15) 
>>
>> E/AndroidRuntime(  715):     at 
>> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 
>>
>> E/AndroidRuntime(  715):     at 
>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231) 
>>
>> E/AndroidRuntime(  715):     at 
>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
>> E/AndroidRuntime(  715):     at 
>> android.app.ActivityThread.access$1800(ActivityThread.java:112)
>> E/AndroidRuntime(  715):     at 
>> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
>> E/AndroidRuntime(  715):     at 
>> android.os.Handler.dispatchMessage(Handler.java:99)
>> E/AndroidRuntime(  715):     at android.os.Looper.loop(Looper.java:123)
>> E/AndroidRuntime(  715):     at 
>> android.app.ActivityThread.main(ActivityThread.java:3948)
>> E/AndroidRuntime(  715):     at 
>> java.lang.reflect.Method.invokeNative(Native Method)
>> E/AndroidRuntime(  715):     at 
>> java.lang.reflect.Method.invoke(Method.java:521)
>> E/AndroidRuntime(  715):     at 
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 
>>
>> E/AndroidRuntime(  715):     at 
>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
>> E/AndroidRuntime(  715):     at dalvik.system.NativeStart.main(Native 
>> Method)
>>
>>
>> Am 03.07.2009 um 14:27 schrieb Ceki Gulcu:
>>
>>>
>>> Try running the following program.
>>>
>>> import org.slf4j.*;
>>>
>>> class Main {
>>> public static void main(String[] args) {
>>>
>>>   Logger logger = LoggerFactory.getLogger(Main.class);
>>>   logger.debug("hello Android");
>>> }
>>> }
>>>
>>> and see if it runs under Android.
>>>
>>> Max Braun wrote:
>>>> Sure, what do you want me to try?
>>>> Am 02.07.2009 um 19:47 schrieb Ceki Gulcu:
>>>>>
>>>>> I went and downloaded openrdf-sesame-2.3-pr1-sdk.zip. I could find, 
>>>>> in addition to slf4j-api.jar, both slf4j-jdk14.jar and logback-*.jar.
>>>>>
>>>>> Would it be possible for you to try running a small test 
>>>>> application under Android? openrdf-sesame is quite big...
>>>>>
>>>>> Max Braun wrote:
>>>>>> Sorry, I meant "slf4j-api-1.5.8.jar and slf4j-jdk14-1.5.8.jar" of 
>>>>>> course. It shouldn't have anything to do with differing versions 
>>>>>> then, right?
>>>>>> Max
>>>>>> Am 02.07.2009 um 18:47 schrieb Ceki Gulcu:
>>>>>>>
>>>>>>> Hello Max,
>>>>>>>
>>>>>>> Which version of slf4j-api is on your class path?
>>>>>>>
>>>>>>> "I'm using slf4j-jdk14-1.5.8.jar and slf4j-jdk14-1.5.8.jar" is 
>>>>>>> not very clear.
>>>>>>>
>>>>>>> See also
>>>>>>> http://slf4j.org/faq.html#compatibility
>>>>>>> http://slf4j.org/faq.html#IllegalAccessError
>>>>>>> http://slf4j.org/manual.html
>>>>>>>
>>>>>>> BR
>>>>>>>
>>>>>>> Max Braun wrote:
>>>>>>>> Hi,
>>>>>>>> I'm trying to get Sesame to run on Android. There seems to be a 
>>>>>>>> problem with SLF4J, which is used by Sesame, resulting in the 
>>>>>>>> following error:
>>>>>>>> E/ActivityThread( 724): Failed to find provider info for 
>>>>>>>> com.google.settings
>>>>>>>> I/dalvikvm( 724): DexOpt: access denied from 
>>>>>>>> Lorg/slf4j/LoggerFactory; to field 
>>>>>>>> Lorg/slf4j/impl/StaticLoggerBinder;.SINGLETON
>>>>>>>> W/dalvikvm( 724): VFY: unable to resolve static field 3716 
>>>>>>>> (SINGLETON) in Lorg/slf4j/impl/StaticLoggerBinder;
>>>>>>>> W/dalvikvm( 724): VFY: rejecting opcode 0x62 at 0x0006
>>>>>>>> W/dalvikvm( 724): VFY: rejected 
>>>>>>>> Lorg/slf4j/LoggerFactory;.getSingleton 
>>>>>>>> ()Lorg/slf4j/impl/StaticLoggerBinder;
>>>>>>>> W/dalvikvm( 724): Verifier rejected class Lorg/slf4j/LoggerFactory;
>>>>>>>> I hope someone here can help me with this.
>>>>>>>> I'm using slf4j-jdk14-1.5.8.jar and slf4j-jdk14-1.5.8.jar. My 
>>>>>>>> initial question in the Sesame forum can be found here: 
>>>>>>>> http://www.openrdf.org/forum/mvnforum/viewthread?thread=2145
>>>>>>>> Thanks,
>>>>>>>> Max
>>>>>>>
>>>>>>> -- 
>>>>>>> Ceki Gülcü
>>>>>>> Logback: The reliable, generic, fast and flexible logging 
>>>>>>> framework for Java.
>>>>>>> http://logback.qos.ch
>>>>>>> _______________________________________________
>>>>>>> user mailing list
>>>>>>> user at slf4j.org
>>>>>>> http://www.slf4j.org/mailman/listinfo/user
>>>>>> _______________________________________________
>>>>>> user mailing list
>>>>>> user at slf4j.org
>>>>>> http://www.slf4j.org/mailman/listinfo/user
>>>>>
>>>>> -- 
>>>>> Ceki Gülcü
>>>>> Logback: The reliable, generic, fast and flexible logging framework 
>>>>> for Java.
>>>>> http://logback.qos.ch
>>>>> _______________________________________________
>>>>> user mailing list
>>>>> user at slf4j.org
>>>>> http://www.slf4j.org/mailman/listinfo/user
>>>> _______________________________________________
>>>> user mailing list
>>>> user at slf4j.org
>>>> http://www.slf4j.org/mailman/listinfo/user
>>>
>>> -- 
>>> Ceki Gülcü
>>> Logback: The reliable, generic, fast and flexible logging framework 
>>> for Java.
>>> http://logback.qos.ch
>>> _______________________________________________
>>> user mailing list
>>> user at slf4j.org
>>> http://www.slf4j.org/mailman/listinfo/user
>>
>> _______________________________________________
>> user mailing list
>> user at slf4j.org
>> http://www.slf4j.org/mailman/listinfo/user
> 
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user

-- 
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Net Services
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad.lajoie at switch.ch, http://www.switch.ch




More information about the slf4j-user mailing list