clojure-android / lein-droid

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

lein-droid doesn't use correct directory separators on Windows #15

Closed MrGung closed 11 years ago

MrGung commented 11 years ago

Hi,

I get the error mentioned in the subject when doing "lein droid apk": The path C:\monacljisa\target/monacljisa-debug-unaligned.apk doesn't exist. Abort execution.

Well, there really is no monacljisa-debug-unaligned.apk - how could I get one? ;-)

best

alexander-yakushev commented 11 years ago

Could you please run the command you are running in the following fashion:

DEBUG=1 lein driod doall

And post here what exactly happens before the aforementioned error?

EDITED: Sorry, the command I supplied is for Linux. I don't quite know how to set shell variables in Windows. Could you figure that out yourself and set DEBUG variable to 1 in this command?

MrGung commented 11 years ago

Hi,

I am on Windows. What is DEBUG=1 supposed to do? Would this work on Win? (I am at work - so I can't simply run it and see for myself).

best Steffen

 -------- Original-Nachricht --------  Datum: Sun, 20 Jan 2013 12:52:08 -0800  Von: Alexander Yakushev notifications@github.com  An: alexander-yakushev/lein-droid lein-droid@noreply.github.com  CC: "Steffen Glückselig" gist@gungfu.de  Betreff: Re: [lein-droid] The path C:\monacljisa\target/monacljisa-debug-unaligned.apk doesn\'t exist. Abort execution. (#15)  &#xA

alexander-yakushev commented 11 years ago

OK, I guess I found how to do it on Windows. You should execute the following commands:

SET DEBUG=1
lein droid doall

Environment variable value persists through the entire CMD session. For more info you can consult this page: http://ss64.com/nt/set.html .

MrGung commented 11 years ago

Oh - ok - it's an environment variable... ;-)

Shortening some paths I got:

Creating DEX....
c:\adt\sdk/platform-tools/dx --dex --no-optimize --output C:\monac\target/classes.dex C:\monac\target\classes c:\adt\sdk/tools/support/annotations.jar C:\Users\Steffen\.m2\repository\android\tools.nrepl\0.2.0-bigstack\tools.nrepl-0.2.0-bigstack.jar C:\Users\Steffen\.m2\repository\android\clojure\1.4.0\clojure-1.4.0.jar C:\Users\Steffen\.m2\repository\neko\neko\2.0.0-beta1\neko-2.0.0-beta1.jar

Crunching resources...
c:\adt\sdk/platform-tools/aapt crunch -v -S C:\monac\res -C C:\monac\target/res
Crunching PNG Files in source dir: C:\monac\res To destination dir: C:\monac\target\res
Packaging resources...
c:\adt\sdk/platform-tools/aapt package --no-crunch -f --debug-mode --auto-add-overlay -M C:\monac\AndroidManifest.xml -S C:\monac\target/res -S C:\monac\res -A C:\monac\assets -I c:\adt\sdk/platforms/android-17/android.jar -F C:\monac\target/monacljisa.ap_ --generate-dependencies

Creating APK...
c:\adt\sdk/tools/apkbuilder C:\monac\target/monacljisa-debug-unaligned.apk -u -z C:\monac\target/monacljisa.ap_ -f C:\monac\target/classes.dex -rj

Signing APK...
The path C:\monac\target/monacljisa-debug-unaligned.apk doesn't exist. Abort execution.

Calling apkbuilder directly I get

>apkbuilder.bat C:\monac\target/monacljisa-debug-unaligned.apk -u -z C:\monac\target/monacljisa.ap_ -f C:\monac\target/classes.dex -rj

THIS TOOL IS DEPRECATED. See --help for more information.

Missing value for -rj

Since lein-droid does not call apkbuilder.bat - I created an wrapping EXE (via autohotkey) that should pass all commandline arguments on to the BAT. Maybe that does not work. Maybe something was lost. Maybe there is an argument not given by lein-droid...

alexander-yakushev commented 11 years ago

Sorry for the late response. Can you please show me your project.clj? It seems like Clojure JAR is missing in it for some reason.

MrGung commented 11 years ago

Here's my project.clj:

(defproject monacljisa/monacljisa "0.0.1-SNAPSHOT" :description "FIXME: Android project description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :min-lein-version "2.0.0"

:warn-on-reflection true

:source-paths ["src/clojure"]

:javac-target "1.6" :javac-options {:debug "on"}

:java-source-paths ["src/java" "gen"] ;; The following two definitions are optional. The default ;; target-path is "target", but you can change it to whatever you like. ;; :target-path "bin" ;; :compile-path "bin/classes"

;; Uncomment this line if your project doesn't use Clojure. Also ;; don't forget to remove respective dependencies. ;; java-only true

:dependencies [[android/clojure "1.4.0"] [neko/neko "2.0.0-beta1"]] :profiles {:dev {:dependencies [[android/tools.nrepl "0.2.0-bigstack"]] :android {:aot :all-with-unused :keystore-path "c:\Users\Steffen.android" :key-alias "debug.keystore"}} ;; :release {:android ;; {;; Specify the path to your private ;; ;; keystore and the the alias of the ;; ;; key you want to sign APKs with. ;; ;; :keystore-path "/home/user/.android/private.keystore" ;; ;; :key-alias "mykeyalias" ;; :aot :all}} }

:android {;; Specify the path to the Android SDK directory either ;; here or in your ~/.lein/profiles.clj file. :sdk-path "c:\Users\Steffen\adt-bundle-windows-x86_64\sdk"

        ;; Uncomment this if dexer fails with OutOfMemoryException
        ;; :force-dex-optimize true

        :target-version "17"
        :aot-exclude-ns ["clojure.parallel"]})
alexander-yakushev commented 11 years ago

Damn directory separators...

I just pushed a fix as 0.1.0-beta6 version to Clojars which should solve the problem.

MrGung commented 11 years ago

Thanks - works!