Browse files

Add extracted native libraries from jars to the list of native librar…

…ies to be packaged in the apk
  • Loading branch information...
AdamClements committed Feb 17, 2014
1 parent 66360a5 commit ace1ea213410b71fb4ffd43e313c6cc86275891f
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/leiningen/droid/sdk.clj
@@ -15,20 +15,27 @@
(.newInstance constructor (into-array [(io/file apk-name) (io/file res-path)
(io/file dex-path) nil nil]))))
+(defn add-unpackaged-natives [other-native-paths]
+ (let [unpackaged-natives-path "target/native/linux/"]
+ (if (.exists (io/file unpackaged-natives-path))
+ (conj other-native-paths unpackaged-natives-path)
+ other-native-paths)))
(defn create-apk
"Delegates APK creation to ApkBuilder class in sdklib.jar."
[{{:keys [sdk-path out-res-pkg-path out-dex-path native-libraries-paths]}
:android} & {:keys [apk-name resource-jars]}]
;; Dynamically load sdklib.jar
(pomegranate/add-classpath (io/file sdk-path "tools" "lib" "sdklib.jar"))
(let [apkbuilder-class (Class/forName "")
- apkbuilder (make-apk-builder apk-name out-res-pkg-path out-dex-path)]
+ apkbuilder (make-apk-builder apk-name out-res-pkg-path out-dex-path)
+ all-native-libraries (add-unpackaged-natives native-libraries-paths)]
(when (seq resource-jars)
(debug "Adding resource libraries: " resource-jars))
(doseq [rj resource-jars]
(.addResourcesFromJar apkbuilder rj))
- (when (seq native-libraries-paths)
- (debug "Adding native libraries: " native-libraries-paths))
- (doseq [lib native-libraries-paths]
+ (when (seq all-native-libraries)
+ (debug "Adding native libraries: " all-native-libraries))
+ (doseq [lib all-native-libraries]
(.addNativeLibraries apkbuilder ^File (io/file lib)))
(.sealApk apkbuilder)))

0 comments on commit ace1ea2

Please sign in to comment.