clojure-android / lein-droid

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

path problems in windows #138

Open roti opened 8 years ago

roti commented 8 years ago

Android SDK is installed in C:\Program Files\Android\android-sdk. Running lein droid doall throws the windows path-nightmare error:

Compiling clojure.repl
Compiling clojure.tools.nrepl.middleware.interruptible-eval
Compiling neko.-utils
Compiling neko.doc
Compilation succeeded.
Creating DEX....
Abort execution.
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
alexander-yakushev commented 8 years ago

The last time I've looked into this issue it was much easier just to move the android SDK into some other place without spaces:(.

roti commented 8 years ago

I did that and it works.

AngryGami commented 8 years ago

I somewhat similar problem

Creating DEX....
unknown output extension: C:\Users\Me\projects\myproject\target\debug
usage:
  dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals]

My paths either to project or android sdk are without spaces. So solution above didn't worked.

alexander-yakushev commented 8 years ago

You should run lein with DEBUG environment variable set to 1, and see which exact command is being called.

AngryGami commented 8 years ago

Don't know what is actually wrong here:

cmd.exe /C C:\Users\me\programs\androidsdk\sdk\build-tools\android-4.2.2\dx.bat -JXmx4096M --incremental --dex --no-optimize --output C:\Users\me\projects\myproj\target\debug C:\Users\me\projects\myproj\target\debug\classes C:\Users\me\.m2\repository\neko\neko\4.0.0-alpha5\neko-4.0.0-alpha5.jar C:\Users\me\.m2\repository\org\clojure\tools.nrepl\0.2.10\tools.nrepl-0.2.10.jar C:\Users\me\.m2\repository\org\clojure-android\clojure\1.7.0-r2\clojure-1.7.0-r2.jar C:\Users\me\projects\myproj\target\debug\aar-extracted\com.android.support_multidex_aar_1.0.0\classes.jar C:\Users\me\programs\androidsdk\sdk\tools\support\annotations.jar
alexander-yakushev commented 8 years ago

Try running this command manually from the shell, but add a slash to the end of the --output, so it becomes:

cmd.exe /C C:\Users\me\programs\androidsdk\sdk\build-tools\android-4.2.2\dx.bat -JXmx4096M --incremental --dex --no-optimize --output C:\Users\me\projects\myproj\target\debug\ C:\Users\me\projects\myproj\target\debug\classes C:\Users\me\.m2\repository\neko\neko\4.0.0-alpha5\neko-4.0.0-alpha5.jar C:\Users\me\.m2\repository\org\clojure\tools.nrepl\0.2.10\tools.nrepl-0.2.10.jar C:\Users\me\.m2\repository\org\clojure-android\clojure\1.7.0-r2\clojure-1.7.0-r2.jar C:\Users\me\projects\myproj\target\debug\aar-extracted\com.android.support_multidex_aar_1.0.0\classes.jar C:\Users\me\programs\androidsdk\sdk\tools\support\annotations.jar

Will that work?

AngryGami commented 8 years ago

Nope :(

alexander-yakushev commented 8 years ago

The problem is, dx on Windows wants to treat the --output path as a file, when it is a path. I don't really know why. Another thing you can do is to put :out-dex-path to your :android map in project.clj, and set it to target\debug\classes.dex.

(defproject ...
  ...
  :android {...
            :out-dex-path "target\debug\classes.dex"
AngryGami commented 8 years ago

This move me one step further :) It manages to do dexing but now complains that:

Creating APK...
No *.dex files found in  C:\Users\Rodion\projects\smarthomeclj\target\debug\classes.dex

Probably because now lein-droid expect that "classes.dex" is a directory :)

AngryGami commented 8 years ago

Ha! I found what was happening. It was using tools for android-4.2.2 while proper tools version should be 21.1.2. Now it builds.

alexander-yakushev commented 8 years ago

That's good news:).