clojure-android / neko

The Clojure/Android Toolkit
Other
297 stars 36 forks source link

Neko fails to load on ART runtime #37

Closed Tirael90 closed 9 years ago

Tirael90 commented 10 years ago

Hello, I'm trying to use neko(3.1.0-SNAPSHOT / 3.0.2) on emulator/real device Nexus 5 with latest stable version of Android KitKat. On dalvik runtime my application with neko loads just fine, but on ART runtime I get an error that is posted in the end of the post. I did a little bit of searching and it seems that function neko.compilation.clear-cache is rejected by Android verifier because 'it is too complex'. Any response to this would be highly appreciated. Thanks, Martin.

08-25 13:46:13.603 3496-3512/kauer.martin.grader E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-118 Process: kauer.martin.grader, PID: 3496 java.lang.VerifyError: Rejecting class neko.compilation$clear_cache because it failed compile-time verification (declaration of 'neko.compilation$clear_cache' appears in /data/app/kauer.martin.grader-2.apk) at neko.compilationinit.load(Unknown Source) at neko.compilationinit.(Unknown Source) at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:305) at clojure.lang.RT.loadClassForName(RT.java:2140) at clojure.lang.RT.load(RT.java:455) at clojure.lang.RT.load(RT.java:436) at clojure.core$load$fn5066.invoke(core.clj:5640) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn5015.invoke(core.clj:5485) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5528) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5545) at clojure.lang.RestFn.invoke(RestFn.java:408) at neko.init$loading4958auto.invoke(init.clj:12) at neko.initinit.load(Unknown Source) at neko.initinit.(Unknown Source) at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:305) at clojure.lang.RT.loadClassForName(RT.java:2140) at clojure.lang.RT.load(RT.java:455) at clojure.lang.RT.load(RT.java:436) at clojure.core$load$fn5066.invoke(core.clj:5640) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5485) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5545) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at kauer.martin.grader.SplashActivity$1.run(SplashActivity.java:59) at java.lang.Thread.run(Thread.java:811)

AdamClements commented 10 years ago

The issue here is the with-locking macro producing monitor-enter and monitor-exit instructions which don't pass verification. I made a change to the with locking macro which is in clojure-android/clojure master which fixes this on dalvik and art. There hasn't been a release build since. It still doesn't allow you to use the repl though. You need to build from master and lein install it locally or I could upload an unofficial snapshot one to clojars tomorrow if you can't figure it out (don't forget to check out the git submodules when building clojure android, that was my main mistake when i first tried it).

An alternative solution would be to rewrite neko not to use this macro, and then not include nrepl as it doesn't work anyway!

Adam On Aug 25, 2014 6:56 PM, "Tirael90" notifications@github.com wrote:

Hello, I'm trying to use neko(3.1.0-SNAPSHOT / 3.0.2) on emulator/real device Nexus 5 with latest stable version of Android KitKat. On dalvik runtime my application with neko loads just fine, but on ART runtime I get an error that is posted in the end of the post. I did a little bit of searching and it seems that function neko.compilation.clear-cache is rejected by Android verifier because 'it is too complex'. Any response to this would be highly appreciated. Thanks, Martin.

08-25 13:46:13.603 3496-3512/kauer.martin.grader E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-118 Process: kauer.martin.grader, PID: 3496 java.lang.VerifyError: Rejecting class neko.compilation$clear_cache because it failed compile-time verification (declaration of 'neko.compilation$clear_cache' appears in /data/app/kauer.martin.grader-2.apk) at neko.compilationinit.load(Unknown Source) at neko.compilationinit.(Unknown Source) at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:305) at clojure.lang.RT.loadClassForName(RT.java:2140) at clojure.lang.RT.load(RT.java:455) at clojure.lang.RT.load(RT.java:436) at clojure.core$load$fn5066.invoke(core.clj:5640) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn5015.invoke(core.clj:5485) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5528) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5545) at clojure.lang.RestFn.invoke(RestFn.java:408) at neko.init$loading4958auto.invoke(init.clj:12) at neko.initinit.load(Unknown Source) at neko.initinit.(Unknown Source) at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:305) at clojure.lang.RT.loadClassForName(RT.java:2140) at clojure.lang.RT.load(RT.java:455) at clojure.lang.RT.load(RT.java:436) at clojure.core$load$fn5066.invoke(core.clj:5640) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5485) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5545) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at kauer.martin.grader.SplashActivity$1.run(SplashActivity.java:59) at java.lang.Thread.run(Thread.java:811)

— Reply to this email directly or view it on GitHub https://github.com/clojure-android/neko/issues/37.

Tirael90 commented 10 years ago

Thank you, Adam, for your response. The issue is really the locking macro, which is used in functions in neko.compilation. Nevertheless, when I built clojure-droid from latest src, including your change of this macro, the result is still the same for me. When I modified neko to not use locking macro, everything works just fine. I honestly do not know what am I doing wrong, I will try to figure it out tommorow.

AdamClements commented 10 years ago

Oh, the other issue I had, make sure you aren't pulling in normal closure (without the change) via one of your dependencies! Do a lein deps :tree to check. Make sure you have a lein global exclusion for org.clojure/clojure and do a clean, otherwise you might end up with a weird hybrid of both. On Aug 25, 2014 11:32 PM, "Tirael90" notifications@github.com wrote:

Thank you, Adam, for your response. The issue is really the locking macro, which is used in functions in neko.compilation. Nevertheless, when I built clojure-droid from latest src, including your change of this macro, the result is still the same for me. When I modified neko to not use locking macro, everything works just fine. I honestly do not know what am I doing wrong, I will try to figure it out tommorow.

— Reply to this email directly or view it on GitHub https://github.com/clojure-android/neko/issues/37#issuecomment-53345614.

Tirael90 commented 10 years ago

I already checked those things, I have right pull, exclusion set, dependencies all set to the custom build and no other build of clojure-droid in my repository. But unfortunately result is still the same. I did clean build of clojure-droid -> neko -> my app.

alexander-yakushev commented 9 years ago

@Tirael90 ,

Now that both problems with ART and Lollipop are fixed, can you please confirm it works for you?

Tirael90 commented 9 years ago

It is indeed fixed. Working fine. Thank you very much! On 3. 12. 2014 15:03, Alexander Yakushev wrote:

@Tirael90 https://github.com/Tirael90 ,

Now that both problems with ART and Lollipop are fixed, can you please confirm it works for you?

— Reply to this email directly or view it on GitHub https://github.com/clojure-android/neko/issues/37#issuecomment-65410792.