clojure-android / lein-droid

A Leiningen plugin for building Clojure/Android projects
Eclipse Public License 1.0
645 stars 56 forks source link

Exception building with preview2 #70

Closed kenrestivo closed 10 years ago

kenrestivo commented 10 years ago

I tried creating a new project following the tutorial using the latest lein-droid, and ran into this:

Compiling neko.ui.menu
Exception in thread "main" java.lang.RuntimeException: Unable to find static field: SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW in interface android.view.MenuItem, compiling:(neko/ui/menu.clj:116:5)
    at clojure.lang.Compiler.analyze(Compiler.java:6380)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$CaseExpr$Parser.parse(Compiler.java:8412)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
    at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6009)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2669)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.access$100(Compiler.java:37)
    at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:529)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler.compile1(Compiler.java:7148)
    at clojure.lang.Compiler.compile(Compiler.java:7219)
    at clojure.lang.RT.compile(RT.java:423)
    at clojure.lang.RT.load(RT.java:463)
    at clojure.lang.RT.load(RT.java:436)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$compile$fn__5023.invoke(core.clj:5541)
    at clojure.core$compile.invoke(core.clj:5540)
    at user$eval17.invoke(form-init1458082931118074506.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6609)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.Compiler.loadFile(Compiler.java:7020)
    at clojure.main$load_script.invoke(main.clj:299)
    at clojure.main$init_opt.invoke(main.clj:304)
    at clojure.main$initialize.invoke(main.clj:332)
    at clojure.main$null_opt.invoke(main.clj:367)
    at clojure.main$main.doInvoke(main.clj:445)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to find static field: SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW in interface android.view.MenuItem
    at clojure.lang.Util.runtimeException(Util.java:219)
    at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6771)
    at clojure.lang.Compiler.analyze(Compiler.java:6343)
    ... 56 more
Compilation failed.

Sadly I have no idea why. My guess is that perhaps there's a dependency on a newer rev of the SDK than I have? I'll try upgrading that, but documenting it here in case others run into it.

alexander-yakushev commented 10 years ago

Hello Ken, your guess was right, this field appeared in SDK v14. What version are you trying to build against?

kenrestivo commented 10 years ago

API 13, which is the device I have. Sadly, if clojure Android requires API 14 then I can't use it.

kenrestivo commented 10 years ago

Confirming it builds fine with API 14, thanks. Might be good to have a minimum API level enforced in the compile task. My apologies if the minimum API 14 was mentioned in the docs and I didn't see it.

alexander-yakushev commented 10 years ago

Well, it is mostly my fault. Minimal SDK bumped to ICS relatively recently. I should certainly put a warning on that.

Can you try targeting SDK 14, but setting minSdkVersion in AndroidManifest.xml to 13? I thought Honeycomb to be fairly compatible with ICS.

kenrestivo commented 10 years ago

That works too. Turns out my device is actually API 14 anyway, (CM 9.1, I thought it was 13, but it's 4.0.4 or 14) so I'm happily using Clojure on Android with Nrepl and amazed. Thanks again!

alexander-yakushev commented 10 years ago

You are welcome! Glad it works now.

I'll reopen the issue so that I don't forget to update the documentation regarding minimal version.

alexander-yakushev commented 10 years ago

Put the version requirement first thing in the tutorial. Thanks for help, Ken!