skummet ReflectiveOperationException dependency

31 views
Skip to first unread message

Benoît Ganne

unread,
May 24, 2016, 3:06:09 AM5/24/16
to clojure...@googlegroups.com
Hi all,

1st let me thank you for the great job with clojure-android, this is
great! I never jumped into Android dev because Java bore me to death,
but developing in Clojure brings the fun back :) !

While developing a simple app to manage tethering more easily
(scratching my own itch here) I ran into a problem with recent Android
SDK: skummet clojure.lang.Var:derefLean() catches
java.lang.ReflectiveOperationException which has been introduced in
Android 19 - meaning you cannot use skummet for Android < 19.
Clojure-android advertises android 15+ compatibility, and moreover my
phone is running Android 17, so I really want skummet to work with it :)

The strange thing is that it had worked at some point in the past... But
it does no longer work. I suspect an update to the Android SDK
introduced more checks in that area...

My short term solution is to workaround that by implementing my own
javal.lang.ReflectiveOperationException:
https://github.com/bganne/autoteth/commit/da5a06d1d7aa08065110af4ace1b577a5172177e

That actually works for me. But it might be better to change skummet to
catch java.lang.Exception instead?

If I do not implement my workaround, I get a VerifyError. As it is
thrown by Dalvik itself, I cannot catch it:
W/dalvikvm( 1784): VFY: unable to resolve exception class 1211
(Ljava/lang/ReflectiveOperationException;)
W/dalvikvm( 1784): VFY: unable to find exception handler at addr 0x55
W/dalvikvm( 1784): VFY: rejected Lclojure/lang/Var;.derefLean
()Ljava/lang/Object;
W/dalvikvm( 1784): VFY: rejecting opcode 0x0d at 0x0055
W/dalvikvm( 1784): VFY: rejected Lclojure/lang/Var;.derefLean
()Ljava/lang/Object;
W/dalvikvm( 1784): Verifier rejected class Lclojure/lang/Var;
W/dalvikvm( 1784): Exception Ljava/lang/VerifyError; thrown while
initializing Lfr/benou/autoteth/bt/main;
W/dalvikvm( 1784): Class init failed in newInstance call
(Lfr/benou/autoteth/bt/main;)
D/AndroidRuntime( 1784): Shutting down VM

ben

Alexander Yakushev

unread,
May 24, 2016, 3:23:16 AM5/24/16
to clojure-android
Hi Benoît,

Thanks for the kind words! Regarding that exception, I didn't know that class has been introduced in Java 1.7 (and, consequently, in later Androids). There is no hard reason to keep it, so I replaced it with plain Exception, and pushed the changes as org.skummet/clojure 1.7.0-r2. Please, try it out and reply if it works for you now!

Best regards,
Alex

Benoît Ganne

unread,
May 27, 2016, 2:13:01 AM5/27/16
to clojure...@googlegroups.com
> I replaced it with plain Exception, and pushed the changes as
> org.skummet/clojure 1.7.0-r2. Please, try it out and reply if it
> works for you now!

Yep it works for me. I am using rc2 and removed my hack.
Thanks!

ben
Reply all
Reply to author
Forward
0 new messages