Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add option to force DEX file optimization

dx tool fails with OutOfMemory error on big project with --no-optimize
flag enabled
  • Loading branch information...
commit 1928f2e585c3074f64da4f47336804189c5c1d41 1 parent ac52ef3
@alexander-yakushev alexander-yakushev authored
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject lein-droid/lein-droid "0.1.0-beta3"
+(defproject lein-droid/lein-droid "0.1.0-SNAPSHOT"
:description "Plugin for easy Clojure/Android development and deployment"
:url "https://github.com/alexander-yakushev/lein-droid"
:license {:name "Eclipse Public License"
View
4 res/templates/project.clj
@@ -29,5 +29,9 @@
:android {;; Specify the path to the Android SDK directory either
;; here or in your ~/.lein/profiles.clj file.
;; :sdk-path "/home/user/path/to/android-sdk/"
+
+ ;; Uncomment this if dexer fails with OutOfMemoryException
+ ;; :force-dex-optimize true
+
:target-version "{{target-sdk}}"
:aot-exclude-ns ["clojure.parallel"]})
View
3  sample/project.clj
@@ -32,6 +32,9 @@
;; Uncomment this line to be able to use Google API.
;; :use-google-api true
+ ;; Uncomment this if dexer fails with OutOfMemoryException
+ ;; :force-dex-optimize true
+
;; Use this property to add project dependencies.
;; :project-dependencies [ "/path/to/library/project" ]
:target-version "10"
View
6 src/leiningen/droid/build.clj
@@ -23,12 +23,14 @@
;;
(defn create-dex
"Creates a DEX file from the compiled .class files."
- [{{:keys [sdk-path out-dex-path external-classes-paths]} :android,
+ [{{:keys [sdk-path out-dex-path external-classes-paths
+ force-dex-optimize]} :android,
compile-path :compile-path :as project}]
(info "Creating DEX....")
(ensure-paths sdk-path)
(let [dx-bin (str sdk-path "/platform-tools/dx")
- no-optimize (if (dev-build? project) "--no-optimize" [])
+ no-optimize (if (and (not force-dex-optimize) (dev-build? project))
+ "--no-optimize" [])
annotations (str sdk-path "/tools/support/annotations.jar")
deps (resolve-dependencies :dependencies project)
external-paths (or external-classes-paths [])]

0 comments on commit 1928f2e

Please sign in to comment.
Something went wrong with that request. Please try again.