-
Notifications
You must be signed in to change notification settings - Fork 36
Problem evaluating the *a macro #73
Description
I have been trying to follow some tutorials on android clojure development, mainly this one:
https://github.com/alexander-yakushev/events/blob/master/tutorial.md
However I can't get the *a macro to work correctly. At the moment I try to work directly from a "lein droid repl" in the console as I had some problems with cider before so I want to make sure that my problems with the *a macro is unrelated to that.
Am I doing something wrong here? What?
Should *a evaluate to nil?
When I evaluate the on-ui form I get the following error on the phone:
java.lang.AssertionError: Assert failed: (instance? Activity activity)
Any suggestions on what I should do to solve this problem?
This is what I do:
rm -Rf events3/
lein new droid events3 org.stuff.events :activity MainActivity :target-sdk 15 :app-name EventsListing
cd events3/
lein droid doall
At this point I get the default application on my connected phone (Galaxy Note 3 android 5.0) and everything looks good. I start the repl:
lein droid repl
REPL-y 0.3.7, nREPL 0.2.10
Clojure 1.7.0
Dalvik 0.9
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
user=> (+ 1 1)
2
user=> (in-ns 'org.stuff.events.main)
#object[clojure.lang.Namespace 0x384a57b0 "org.stuff.events.main"]
org.stuff.events.main=> (on-ui (neko.notify/toast "Hello"))
true
org.stuff.events.main=> (*a)
nil
org.stuff.events.main=> (*a :main)
nil
org.stuff.events.main=> (def main-layout [:linear-layout {:orientation :vertical}
#=> [:edit-text {:hint "Event name"}]
#=> [:edit-text {:hint "Event location"}]])
#'org.stuff.events.main/main-layout
org.stuff.events.main=> (defactivity org.stuff.events.MainActivity
#=> :key :main
#=>
#=> (onCreate [this bundle]
#=> (.superOnCreate this bundle)
#=> (on-ui
#=> (set-content-view! (*a) main-layout))
#_=> ))
#'org.stuff.events.main/MainActivity-onCreate
org.stuff.events.main=> (on-ui
#_=> (set-content-view! (*a) main-layout))
true
org.stuff.events.main=> (neko.debug/*a :main)
nil
org.stuff.events.main=> (neko.debug/*a)
nil
BTW: My .lein/profiles look 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.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"]]}
}
Regards,
Mattias Nyrell