Closed Nutomic closed 9 years ago
After some more playing around, it seems like this is caused by errors in the code. However, there is no warning/error in the code, and lein droid doall
happily continues to creating dex and apk, then installing and running.
Also, this problem does not occur if the compile worked before, because the old class file seems to be used (that's why stashing, compiling and unstashing fixed it for me).
Hello Felix,
lein-droid has somewhat changed lately. Can you please recreate the project with lein-droid 0.3.0-beta3
? It tackles problems like cleaning gen/
and assets/
.
So do you mean that there are errors but lein droid doall
gets past them? That is weird. If the problem still persists with the newest version, please direct me to the project files.
Since there was no more input into this, I close the issue as non-reproducible. Feel free to reopen it if the problem persists.
I've run into this same problem several times. For a while I was doing lein droid clean
before every build, but that was somewhat superstitious. I'll see if I can reproduce it reliably.
Just a few more details:
I'm using [lein-droid "0.3.3"]
, [org.clojure-android/clojure "1.7.0-alpha3" :use-resources true]
.
In a working build I see my main namespace get compiled:
[...]
Compiling manifold.deferred
Compiling com.lemondronor.ad1.main
Reflection warning, com/lemondronor/ad1/main.clj:87:3 - call to method speak can't be resolved (target class is unknown).
Compiling clojure.test
[...]
If I then check out the new code that doesn't work and do lein droid doall
, I don't even see my main namespace get compiled:
Compiling manifold.deferred
Compiling clojure.test
At this point an APK containing my old code, not the new code, gets installed and run (successfully). If I now do lein droid clean && lein droid doall
, again I don't see the main namespace get compiled, and the app fails with the java.lang.ClassNotFoundException: Didn't find class "com.lemondronor.ad1.MainActivity" on path: DexPathList...
exception.
Wait, do you do lein droid clean
or lein clean
? Because the latter one is correct.
Also, I would suggest upgrading to lein-droid 0.3.5
just be on the same page.
Gotta close this again as non-reproducible.
Encountered something similar.
Reproduction steps:
Edit the ns require portion of main.clj to contain:
[user :as user]) ; missing a closing square bracket
instead of:
[user :as user]])
Build apk, install, and run via:
lein droid doall
The build should succeed but (at least here) main.clj is never compiled.
When main.clj file has correct ns macro use, output of:
lein droid doall
contains a line like:
Compiling
.main
(let [nses (namespaces-to-compile project)
.
.
.
(doseq [namespace# '~nses]
(println "Compiling" namespace#)
(clojure.core/compile namespace#))
namespaces-to-compile calls bultitude/namespaces-on-classpath and there is the following text in bultitude's README:
By default Bultitude will ignore files that have unreadable ns forms in them in order not to cause problems with projects that include moustache templates on their classpath. Most functions take an ignore-unreadable? arg which you can set to false to make it propagate exceptions from the reader.
@satchit8 This sums it up really well! Thanks for the patch, I committed it and published in lein-droid 0.4.4
.
This seems to happen quite randomly, without changing any code.
dexdump target/classes.dex | grep "MainActivity"
finds nothing.lein clean; rm -r assets/ gen/
does not fix it either, I have to do clean, thengit stash; lein droid doall; git stash pop
. Maybe something is cached somewhere?I can also send you the project files, but it's basically
lein droid new
with minor changes.Btw, I feel like there should be a
lein droid clean
call that also deletesgen/
andassets/
directories ;)Edit: lein-droid is version 0.2.3,
$ lein -v
output:Leiningen 2.5.0 on Java 1.7.0_65 OpenJDK 64-Bit Server VM
, on Kubuntu 14.04.