-
Notifications
You must be signed in to change notification settings - Fork 36
Problem evaluating the *a macro #73
Comments
I tried to replicate the problem of evaluating the *a macro but without success (with both api level 15 and 19), i.e. get a non-nil value here. For reference, my ~/.lein/profiles.clj is: {:android-common
{:android
{:sdk-path "/opt/android-sdk"}
}
} Leiningen and Java info: lein --version
Leiningen 2.7.1 on Java 1.8.0_121 OpenJDK 64-Bit Server VM Hardware for the device was the older nexus 7 running an unofficial lineage os 14.1 (so somewhat similar to nougat?). I think I followed similar enough steps for getting the app running: rm -rf events3
lein new droid events3 org.stuff.events :activity MainActivity :target-sdk 15 :app-name EventsListing
cd events3/
lein droid doall After executing: lein droid repl here's a portion of the repl session: (Warning: profile :android-user not found.) |
Thanks for testing. Then something must be wrong with my setup. I will investigate my android SDK setup further and see if I find something wrong. Thanks for your help. I will report back after trying again. |
After many hours of testing I am still not able to get this to work. These are the versions of the android packages I have installed at the moment:
I originally used java 1.7, but when I noticed that you (satchit8) used java 1.8 I tried that too. I also copied the .lein/profiles.clj above (and replaced the SDK path with my own!). I have tried android sdk tools 26.0.1 but got errors when creating the DEX:
which I believe is due to Android/Sdk/tools/support/annotations.jar being Java 1.8. When I downgrade to sdk tools 25.2.5 it works. |
I'm not sure how much help the following will be, but for the record... FWIW, w/ Java 1.7, here, lein droid doall gives:
The following is what I have for installed packages (sorry, hand-crafted output so likely some errors):
|
Thanks for your list of installed packages, it gives me something to experiment with. I tried to get things working on (yet another) computer, and this time I actually got it working. On this setup I can access (*a) from the repl and also from the cider-repl. I had a great time following the tutorial and experimenting a bit on my own. Now I am back to trying to figure out why it doesn't work on my first computer. I will report back with my results. |
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
The text was updated successfully, but these errors were encountered: