Using CIDER with clojure-android, need some help!

117 views
Skip to first unread message

Mattias Nyrell

unread,
Mar 10, 2017, 7:29:25 AM3/10/17
to clojure-android
Hi,

is anyone out there using CIDER for their clojure-android development? If so, I would very much appreciate some pointers on how to get things working!

I have been trying to follow the tutorial over here:
https://github.com/alexander-yakushev/events/blob/master/tutorial.md

and also the similar instructions over here:
http://www.lambdacat.com/clojure-on-android-workflow-setup-ii/


I can start a REPL with:
lein droid repl

but I do not seem to be able to do much with it. If I connect to it using "M-x cider-connect" I get a bunch of error messages about mismatching CIDER versions and cider-nrepl versions (see below). If I continue anyway and try do "C-x C-e" on the "on-ui" form for example I get the following error on the phone:
java.lang.AssertionError: Assert failed: (instance? Activity activity)


If anyone could share a setup that works it would be great.

* All tutorials I have seen talks about CIDER 0.9.1, do I need to downgrade to this or will it work with a newer version?

* Do I need to use cider-connect or can I use cider-jack-in which seem to be recommended if I read the CIDER documentation?

* Which version (if any) of cider-nrepl should I use in my .lein/profiles.clj?


I really want to get this working! :-)

Best regards,
Mattias Nyrell


PS.
The errors I get from "M-x cider-connect" with my current setup:

WARNING: CIDER requires nREPL 0.2.12 (or newer) to work properly
         More information.
WARNING: CIDER's version (0.15.0-snapshot) does not match cider-nrepl's version (nil). Things will break!
         More information.
WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.3.0-SNAPSHOT (package: 20170126.118) and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.


My ".lein/profiles.clj" looks like this:

{:user {:plugins [ [lein-droid "0.4.6"] ] }
 :android-common {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]
                  :android {:sdk-path "/home/matny/prg/Android/Sdk"}}
 :android-user {:dependencies [ [cider/cider-nrepl "0.9.1"] ]
                ;:dependencies [ [cider/cider-nrepl "0.15.0-SNAPSHOT"] ]
                :android {:aot-exclude-ns ["cider.nrepl.middleware.util.java.parser"
                                           "cider.nrepl" "cider-nrepl.plugin"]}}
 :repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}

 }


Adam Clements

unread,
Mar 10, 2017, 12:23:12 PM3/10/17
to clojure-android
Hi, 

(Disclaimer, I'm trying to help with 1.5year old knowledge as I've not been working on clojure-android stuff for a while)

So it looks like it's not pulling in your profile (hence the nil cider-nrepl version), so we should probably sort that out first. If you have a working lein repl anywhere... then cider-connect will let you connect to that. cider-jack-in runs `lein repl :headless` for you, but by default that will only pull in the base + user profiles. Your lein/profiles.clj looks a bit all over the place, I suggest you go read the leiningen docs about profiles and how merging profiles works (I'm not sure if you intended to create a profile called :repl for example? and your android-user profile doesn't point at the sdk-path so won't find the sdk if you use that, unless you activate both profiles at once - perhaps you intended to set up some inheritance? Again I refer you to the leiningen docs). 

In order to get going with what you have, I think you need to know about `lein with-profile +user,+android-common,+android-user repl` (I think - haven't tested) the + tells it to include the default base profile, which you might not want actually as it might have a conflicting version of clojure... Note that if you have profiles with the same name in your project.clj, I'm not sure what will happen! I think that will just take precedence rather than merge.

lein with-profile <whatever> pprint is your friend - it shows you what the current set of profiles will expand to when passed to the build step in leiningen. Get the idea of what's happening there and the profiles will seem a lot less like magic!

Hope that helps, sorry it's more pointers than an exact solution - like I say I'm not 100% certain of your situation and the current state of the art, but hopefully there's enough there to help you move forward a bit!

Let me know if there's anything else I can do to help

Adam

--
You received this message because you are subscribed to the Google Groups "clojure-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-andro...@googlegroups.com.
To post to this group, send email to clojure...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-android.
For more options, visit https://groups.google.com/d/optout.

Mattias Nyrell

unread,
Mar 12, 2017, 1:57:33 PM3/12/17
to clojure-android

Thanks for you answer!


I had time for some quick testing right now, but I will read up more on the profiles and profile mergning later, but I wanted to share some results right now.


Regarding the :repl profile, I'm actually not sure where I got that. It might be something I read somewhere trying to fix my problems, but since I don't know I try to comment it out for now.


Regarding the android-sdk and the android-common and android-user profiles, that setup I got from the lein droid tutorial:
https://github.com/clojure-android/lein-droid/wiki/Tutorial


And the events tutorial:
https://github.com/alexander-yakushev/events/blob/master/tutorial.md


But maybe I didn't understand it right?



I experimented with "with-profile" and pprint a bit, but if I do:

lein droid pprint


and:

lein with-profile +user,+android-common,+android-user droid pprint


The result is almost identical. The only difference is:

{:aot-exclude-ns
("clojure.parallel"
"clojure.core.reducers"
"cider.nrepl"
"cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"
#"cljs-tooling\..+"
"cider.nrepl.middleware.util.java.parser"
"cider.nrepl"
"cider-nrepl.plugin"),
....
:dependencies
(...
[org.clojure/tools.nrepl "0.2.10"]



for "lein droid pprint", vs:

{:aot-exclude-ns
("clojure.parallel"
"clojure.core.reducers"
"cider.nrepl"
"cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"
#"cljs-tooling\..+"
"cider.nrepl.middleware.util.java.parser"
"cider.nrepl"
"cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"
"cider.nrepl"
"cider-nrepl.plugin"),
....
:dependencies
(...
[org.clojure/tools.nrepl "0.2.12"]



for the "with-profile" comman.


This is when I execute the above command in the folder created with:
lein new droid events org.stuff.events :activity MainActivity :target-sdk 15 :app-name EventsListing

following the "event tutorial".


I will continue trying and also read up on the profiles tomorrow. Thanks for the help so so far!


/Mattias

Mattias Nyrell

unread,
Mar 12, 2017, 5:07:24 PM3/12/17
to clojure-android
Hi,

I tried some more things and remembered where that :repl profile came from. It was an (failed) attempt to fix the first warning printed in emacs when I do cider-connect. If I click on "more info" i get sent here:
http://cider.readthedocs.io/en/latest/troubleshooting/

were it says to add this:
{:repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}

but I never get rid of the warning. I have tried various things like adding the dependency to :android-user instead and also using with-profile but no success yet.


When I connect to the REPL using cider-connect some things actually work, like setting the namespace or doing C-x C-e on simple forms like (+ 1 2) and the like. I can't evaluate the "on-ui" forms though. Could the assertion error I get be related to the (*a) macro? If I evaluate (*a) only I get nil which seem very suspect. I read the following on the Neko page:

"Keep in mind that is a debug-time feature, and you should not leave code that relies on (*a) in production. This macro may return a paused/stopped activity which can lead to undefined behavior, or even yield nil. So for the release build use the activity instance provided as first argument to methods (this) and properly pass it to your functions that operate on the Activity."

But I still do not know what to do about it.

Well, I will read up on the profiles tomorrow... If you or anyone else have any further ideas I'm open for them.


/Mattias






Den fredag 10 mars 2017 kl. 13:29:25 UTC+1 skrev Mattias Nyrell:

Mattias Nyrell

unread,
Mar 14, 2017, 12:53:43 PM3/14/17
to clojure-android
Hi again,

I have now tried to read up on the lein profiles. I do not see any immediate solutions, but I will try to attack this problem from two directions:

1. Finding out more about why the Neko macro (*a) returns nil.
2. Finding out how to get CIDER working.


So for problem 1, the status is like this:

Trying to follow the events tutorial I can create a lein droid project and build it. I can start a REPL and connect to it both using "lein droid repl" and "M-x cider-connect". I can change namespace and do things like "(on-ui (neko.notify/toast "Hello"))", but I can't evaluate any forms that contains the (*a) macro. Both (*a) and (*a :main) evaluates to nil.

I don't really know how to go forward with this problem now, so I will focus on problem 2 instead and hope that someone can give me some hints on what to do to solve problem 1.



So, for problem 2, getting CIDER to work:

Adam: If cider-jack-in runs 'lein repl' instead of 'lein droid repl' I guess I will not be able to use this approach right? Unless someone tells me it should work I will abandon cider-jack-in and focus on cider-connect.

So, when I run M-x cider-connect I get some warnings, among others:

WARNING: CIDER's version (0.15.0-snapshot) does not match cider-nrepl's version (nil). Things will break!

Assuming that I get nil because there is something wrong with how my lein profiles are setup, I will try to investigate this further:

If I do lein droid pprint, the lines related to CIDER are:

:android

 {:aot-exclude-ns
  ("clojure.parallel"
   "clojure.core.reducers"
   "cider.nrepl"
   "cider-nrepl.plugin"
   "cider.nrepl.middleware.util.java.parser"
   #"cljs-tooling\..+"
   "cider.nrepl.middleware.util.java.parser"
   "cider.nrepl"
   "cider-nrepl.plugin"),

does this seem OK? I note that they occur twice?

also I have:
 :dependencies
 ([org.clojure-android/clojure "1.7.0-r4"]
  [neko/neko "4.0.0-alpha5"]
  [org.clojure/tools.nrepl "0.2.10"]
  [cider/cider-nrepl "0.9.1"]),

which look OK to me, considering the contents of my .lein/profiles.clj file, or what do you think?

Is there anything else I can do to make it easier to troubleshoot this?

As I wrote earlier my .lein/profiles.clj looks like this:


{:user {:plugins [ [lein-droid "0.4.6"] ] }
 :android-common {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]
                  :android {:sdk-path "/home/matny/prg/Android/Sdk"}}
 :android-user {:dependencies [ [cider/cider-nrepl "0.9.1"] ]
                ;:dependencies [ [cider/cider-nrepl "0.15.0-SNAPSHOT"] ]
                :android {:aot-exclude-ns ["cider.nrepl.middleware.util.java.parser"
                                           "cider.nrepl" "cider-nrepl.plugin"]}}
 :repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}
 }

As you can see I have also experimented with using ":dependencies [ [cider/cider-nrepl "0.15.0-SNAPSHOT"] ]" to match the version of cider I have in emacs (which seems reasonable to me). This however opens up a complete new set of errors, so that is why I asked about cider-jack-in and which versions of cider-nrepl to use in the profile. From reading on the CIDER page I got the impression that it shouldn't be necessary to add any cider-nrepl dependency if I used cider-jack-in.

So... Lots of possible ways to try to solve this. I'm not sure how to proceed, I have tried everything I can think of but without success, so if anyone have a working setup it would be great to see it.

Any suggestions?

Best wishes,

Mattias

Mattias Nyrell

unread,
Mar 15, 2017, 8:09:01 AM3/15/17
to clojure-android
I tried some more things to investigate "Problem 1" (the neko (*a) macro).

First I tried to remove everything related to cider in my profiles to make sure cider was not involved in this problem. I checked with "lein droid pprint" to see that no references to cider present. Then I did "lein droid doall" and "lein droid repl", but (*a) and (*a :main) still returns nil.

I also tried to change "org.clojure/tools.nrepl" to version "0.2.12" instead of "0.2.10". But even though I have changed this value both in my .lein/profiles.clj and the project.clj, and also checked with lein droid pprint that all references to tools.nrepl is to "0.2.12" it still says:
"REPL-y 0.3.7, nREPL 0.2.10"

when I do "lein droid repl". I still get nil for (*a) too...

/Mattias

Adam Clements

unread,
Mar 16, 2017, 12:51:10 PM3/16/17
to clojure-android
I think the easiest thing to do for the moment, just to get you up and running, is ignore your .lein/profiles.clj, add your sdk-path in to your project.clj directly. 

So for reference, if you do lein new droid blargh com.blargh you should end up with a new project folder called blargh. Ignoring your profiles.clj for now, uncomment the sdk-path in the generated project.clj and add [cider/cider-nrepl "0.9.1"] after [org.clojure/tools.nrepl "0.2.10"] in the :dev profile. Then if you run lein droid doall, you should have a connected repl and the sample app. Let me know how that goes and we can work from there.

I've never actually used the *a macro myself - I know it's turned off in production, and I imagine it returns nil if the activity isn't running.

Let me know if there's any output from lein droid doall, drop it in a gist or a pastebin, and also look at adb logcat and see if there's anything happening on the phone (you haven't actually mentioned if you're trying to do this on a phone or an emulator. If you don't have a phone or an emulator set up then that would also explain it, as I don't think it'll do much with out a phone or emulator plugged in and in dev mode)

Adam

Mattias Nyrell

unread,
Mar 16, 2017, 1:36:11 PM3/16/17
to clojure-android
Hi,

I'm running on a connected phone. Samsung Galaxy Note 3, android 5.0.



> I think the easiest thing to do for the moment, just to get you up and running, is ignore your .lein/profiles.clj, add your sdk-path in to your project.clj directly.

Great, I have tried it before, but I'll try it again step by step and maybe you can see where it goes wrong.


lein new droid events2 org.stuff.events :activity MainActivity :target-sdk 15 :app-name EventsListing

cd events2

Edited project.clj:
             ...
             :dev
             [:android-common :android-user
              {:dependencies [[org.clojure/tools.nrepl "0.2.10"]
                              [cider/cider-nrepl "0.9.1"]]
             ...

  :android {;; Specify the path to the Android SDK directory.
            :sdk-path "/home/matny/prg/Android/Sdk"


lein droid doall

The app starts on my phone

lein droid repl

Testing a bit:

(on-ui (neko.notify/toast "Hello"))
works. I see the text on the phone

(*a) still returns nil

Exiting the repl by Ctrl-d. Killing the app on the phone. Doing a new "lein droid doall" to start it up again.

Open main.clj in emacs:
emacs src/clojure/org/stuff/events/main.clj

M-x cider-connect
localhost
9999

Cider starts with the same warnings as mentioned before:

WARNING: CIDER requires nREPL 0.2.12 (or newer) to work properly
         More information.
WARNING: CIDER's version (0.15.0-snapshot) does not match cider-nrepl's version (nil). Things will break!
         More information.
WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.3.0-SNAPSHOT (package: 20170126.118) and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.


The same things work in the cider repl as in the console repl.

Here is the pastebin:
http://pastebin.com/BWmnqvBc

the adb logcat resulted in 2.6 Mb of text so it was to big for pastebin :-)
I will have a closer look at it tomorrow but I don't really know what to look for, so any suggestions are welcome.

Thanks for your help!

/Mattias

Adam Clements

unread,
Mar 16, 2017, 2:14:16 PM3/16/17
to clojure-android
Okay, from that start point, I'd suggest bumping the cider-nrepl to 0.14.0, ideally change your emacs cider version to the stable 0.14.0 instead of the bleeding edge 0.15.0-snapshot, and tools.nrepl to the latest versione I'm wondering if it *is* actually pulling in cider-nrepl, but that version of cider didn't have whatever version function the newer emacs cider code uses to print out the version number. Anyway, it's definitely worth moving to melpa-stable for cider that doesn't change every other day and break something random!

Mattias Nyrell

unread,
Mar 17, 2017, 12:06:19 PM3/17/17
to clojure-android
Ok, here is what I have done, step by step:

First I changed my emacs cider version to 0.14.0. Just to be sure it didn't affect anything else I created a new "event" project and everything behaved like before, except the cider warning I got in emacs now stated:

WARNING: CIDER's version (0.14.0) does not match cider-nrepl's version (nil). Things will break!
         More information.



Then I modified my .lein/profiles.clj to use cider-nrepl 0.14.0:


{:user {:plugins [ [lein-droid "0.4.6"] ] }
 :android-common {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]
                  :android {:sdk-path "/home/matny/prg/Android/Sdk"}}
 :android-user {:dependencies [ [cider/cider-nrepl "0.14.0"] ]

                :android {:aot-exclude-ns ["cider.nrepl.middleware.util.java.parser"
                                           "cider.nrepl" "cider-nrepl.plugin"]}
                }
 :repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}

 }


I created a new project:

rm -Rf events2/

lein new droid events2 org.stuff.events :activity MainActivity :target-sdk 15 :app-name EventsListing


Edited project.clj to use cider-nrepl 0.14.0 and tools.nrepl 0.12.2 and added the SDK path:

:dev

[:android-common :android-user

{:dependencies [[org.clojure/tools.nrepl "0.2.12"]

[cider/cider-nrepl "0.14.0"]]

...

  :android {;; Specify the path to the Android SDK directory.

:sdk-path "/home/matny/prg/Android/Sdk"



Then I tried to build the project with:

lein droid doall

and got the following error:

Generating manifest...
Generating R.java files...
Compiling 3 source files to /home/matny/develop/events2/target/debug/classes
Compiling Clojure files...
Build type: debug, dynamic compilation: enabled, remote REPL: enabled.
Compiling cider.nrepl.middleware.out
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: clojure.instant/thread-local-utc-date-format in this context, compiling:(cider/inlined_deps/fipp/v0v6v6/fipp/ednize.clj:58:13)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6740)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyze(Compiler.java:6495)
        at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3801)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6735)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.access$300(Compiler.java:38)
        at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6139)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6733)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyze(Compiler.java:6495)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5871)
        at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5306)
        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3935)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6731)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyze(Compiler.java:6495)
        at clojure.lang.Compiler$MapExpr.parse(Compiler.java:3060)
        at clojure.lang.Compiler.analyze(Compiler.java:6542)
        at clojure.lang.Compiler.analyze(Compiler.java:6495)
        at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3801)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6735)
        at clojure.lang.Compiler.analyze(Compiler.java:6534)
        at clojure.lang.Compiler.analyze(Compiler.java:6495)
        at clojure.lang.Compiler.compile1(Compiler.java:7328)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$load_lib$fn__5407.invoke(core.clj:5707)
        at clojure.core$load_lib.doInvoke(core.clj:5706)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5745)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5828)
        at clojure.lang.RestFn.invoke(RestFn.java:436)
        at cider.inlined_deps.fipp.v0v6v6.fipp.edn$loading__5350__auto____751.invoke(edn.cljc:1)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3633)
        at clojure.lang.Compiler.compile1(Compiler.java:7333)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$load_lib$fn__5407.invoke(core.clj:5707)
        at clojure.core$load_lib.doInvoke(core.clj:5706)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5745)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5828)
        at clojure.lang.RestFn.invoke(RestFn.java:930)
        at cider.nrepl.middleware.pprint$loading__5350__auto____253.invoke(pprint.clj:1)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3633)
        at clojure.lang.Compiler.compile1(Compiler.java:7333)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$load_lib$fn__5407.invoke(core.clj:5707)
        at clojure.core$load_lib.doInvoke(core.clj:5706)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5745)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5828)
        at clojure.lang.RestFn.invoke(RestFn.java:619)
        at cider.nrepl.middleware.stacktrace$loading__5350__auto____251.invoke(stacktrace.clj:1)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3633)
        at clojure.lang.Compiler.compile1(Compiler.java:7333)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$load_lib$fn__5407.invoke(core.clj:5707)
        at clojure.core$load_lib.doInvoke(core.clj:5706)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5745)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5828)
        at clojure.lang.RestFn.invoke(RestFn.java:512)
        at cider.nrepl.middleware.util.error_handling$loading__5350__auto____44.invoke(error_handling.clj:1)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3633)
        at clojure.lang.Compiler.compile1(Compiler.java:7333)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$load_lib$fn__5407.invoke(core.clj:5707)
        at clojure.core$load_lib.doInvoke(core.clj:5706)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5745)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5828)
        at clojure.lang.RestFn.invoke(RestFn.java:512)
        at cider.nrepl.middleware.out$loading__5350__auto____17.invoke(out.clj:1)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3633)
        at clojure.lang.Compiler.compile1(Compiler.java:7333)
        at clojure.lang.Compiler.compile1(Compiler.java:7323)
        at clojure.lang.Compiler.compile(Compiler.java:7400)
        at clojure.lang.RT.compile(RT.java:408)
        at clojure.lang.RT.load(RT.java:456)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__5458.invoke(core.clj:5862)
        at clojure.core$load.doInvoke(core.clj:5861)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5667)
        at clojure.core$compile$fn__5463.invoke(core.clj:5873)
        at clojure.core$compile.invoke(core.clj:5872)
        at user$eval5.invoke(form-init8838010934682097886.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6792)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.load(Compiler.java:7237)
        at clojure.lang.Compiler.loadFile(Compiler.java:7175)
        at clojure.main$load_script.invoke(main.clj:280)
        at clojure.main$init_opt.invoke(main.clj:285)
        at clojure.main$initialize.invoke(main.clj:313)
        at clojure.main$null_opt.invoke(main.clj:348)
        at clojure.main$main.doInvoke(main.clj:426)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve var: clojure.instant/thread-local-utc-date-format in this context
        at clojure.lang.Util.runtimeException(Util.java:221)
        at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:698)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6733)
        ... 169 more
Compilation failed.



Any ideas?

/Mattias

Adam Clements

unread,
Mar 17, 2017, 12:44:41 PM3/17/17
to clojure...@googlegroups.com
Hmm, well it seems you're not alone: https://github.com/clojure-android/lein-droid/issues/153

Looking at this, it appears cider is using an internal clojure compiler function marked as private (naughty...) which has then changed names in a later release of clojure. In clojure-android/clojure 1.7.0-r2 it's just called utc-date-format.

I actually have a version of clojure for android that doesn't have this problem (and supports 1.8.0), but it doesn't merge nicely with upstream clojure-android/clojure as I rebased and reordered the patches that are required to get clojure running on android for my own project ages ago and maintained my own fork off that. I haven't been keeping up with the community since though, I don't know if anyone's maintaining clojure-android and I don't want to push separate forks really. 

Any active maintainers watching the mailing list?

Adam

Mattias Nyrell

unread,
Mar 18, 2017, 6:22:58 AM3/18/17
to clojure-android
> Hmm, well it seems you're not alone: https://github.com/clojure-android/lein-droid/issues/153

Yes, I noticed that issue some days ago.


> Looking at this, it appears cider is using an internal clojure compiler function marked as private (naughty...) which has then changed names in a later release of clojure. In clojure-android/clojure 1.7.0-r2 it's just called utc-date-format.

ok, so the newer versions of cider-nrepl needs clojure 1.8? Then the only clean solutions to this would be:

a. Downgrading cider to a version that works with 1.7. Probably 0.9.1
b. Upgrading clojure-android to clojure 1.8

a) I did try a while ago but I can't recall what went wrong with that. Possibly the warnings were the same or I just thought that the issue with the (*a) macro returning nil was the fault of cider, and concluded that things didn't work.
b) Is out of my league I think.

Or possibly I do like someone wrote in the lein-droid issue you linked to: Use cider-nrepl 0.9.1 and decide that cider works good enough regardless of the warnings.

If it is only the name of utc-date-format that has changed and newer versions of cider-nrepl do not depend on any new behaviors of clojure 1.8 then it seems it would be easy to make a slight modification to clojure-android by just adding the new function name of utc-date-format also. But I guess it is likely that there are other incompabilities also so it is probably not a good idea.



Regarding the (*a) macro: You wrote that you did not use it. Could you explain how you work instead? Do you have to do a "lein droid doall" between every change, or is there another way to be able to do more interactive development like described in the events tutorial?


From what I have discovered, the (*a) returning nil is not related to cider (which I believed at first) so maybe I should create an issue about this on the Neko site.

Thanks,

Mattias Nyrell


Reply all
Reply to author
Forward
0 new messages