clojure-android / lein-droid

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

0.2.0-beta3: Stub app won't work #61

Closed alcarvalho closed 10 years ago

alcarvalho commented 10 years ago

I just created a brand new app and the SplashActivity, which is written in java in the "stub" app does not seem to make it into the dex. When I try to run it I get the following:

 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.clojure.app/com.example.clojure.app.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.clojure.app.SplashActivity" on path: /data/app/com.example.clojure.app-1.apk
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
    at android.app.ActivityThread.access$700(ActivityThread.java:152)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5328)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.clojure.app.SplashActivity" on path: /data/app/com.example.clojure.app-1.apk
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
    … 11 more

Searching for the class, it does seem to be compiled:

./target/classes/com/example/clojure/app/SplashActivity$1.class
./target/classes/com/example/clojure/app/SplashActivity.class

But the following command doesn't give any output:

dexdump target/classes.dex | grep Splash

alexander-yakushev commented 10 years ago

Hello Andre,

Which version of lein-droid are you using?

alcarvalho commented 10 years ago

Hello Alexander,

the version is 0.2.0-beta3

alexander-yakushev commented 10 years ago

Oh, sorry, confused it with Neko.

So I suppose you use neko 3.0.0-beta6 with it?

Or you can try lein-droid 0.2.0-preview1 with neko 3.0.0-preview1.

alcarvalho commented 10 years ago

Yes.

I just generated the application and tried to test it on the device, using the following commands:

lein droid new app com.example.clojure.app
cd app
lein droid build
lein droid apk

With 0.2.0-preview1 I get the same result. The SplashActivity is not included in the dex. Is this version newer than 0.2.0-beta3?

alexander-yakushev commented 10 years ago

Just a little, though there is nothing related to the splash activity.

Can you please post the output of DEBUG=1 lein droid doall?

alcarvalho commented 10 years ago

That would be this:

$ DEBUG=1 lein droid doall
Leiningen's classpath: :/usr/local/Cellar/leiningen/2.3.2/libexec/leiningen-2.3.2-standalone.jar
Applying task droid to (doall)
Generating R.java...
/Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt package --auto-add-overlay -f -m -M /Users/andre/src/clojure/app/AndroidManifest.xml -S /Users/andre/src/clojure/app/target/res -S /Users/andre/src/clojure/app/res -I /Applications/Android Studio.app/sdk/platforms/android-15/android.jar -J /Users/andre/src/clojure/app/gen --generate-dependencies
Applying task javac to nil
Running javac with [@/var/folders/ps/pqkdw56j2cd16jrbvlxnc2680000gn/T/.leiningen-cmdline2132384198669767080.tmp]
Compiling 1 source files to /Users/andre/src/clojure/app/target/classes
Applying task compile to nil
All namespaces already AOT compiled.
WARNING: :warn-on-reflection is deprecated; use :global-vars.
Running javac with [@/var/folders/ps/pqkdw56j2cd16jrbvlxnc2680000gn/T/.leiningen-cmdline1691360489320045692.tmp]
Compiling Clojure files...
Project classpath: (/Applications/Android Studio.app/sdk/tools/support/annotations.jar /Applications/Android Studio.app/sdk/platforms/android-15/android.jar /Users/andre/src/clojure/app/test /Users/andre/src/clojure/app/src/clojure /Users/andre/src/clojure/app/src /Users/andre/src/clojure/app/dev-resources /Users/andre/src/clojure/app/resources /Users/andre/src/clojure/app/target/classes /Users/andre/.m2/repository/neko/neko/3.0.0-preview1/neko-3.0.0-preview1.jar /Users/andre/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar /Users/andre/.m2/repository/android/tools.nrepl/0.2.0-bigstack/tools.nrepl-0.2.0-bigstack.jar /Users/andre/.m2/repository/compliment/compliment/0.0.2/compliment-0.0.2.jar /Users/andre/.m2/repository/org/clojure-android/clojure/1.5.1-jb/clojure-1.5.1-jb.jar)
Build type: debug, dynamic compilation: enabled, remote REPL: enabled.
Applying task javac to nil
Running javac with [@/var/folders/ps/pqkdw56j2cd16jrbvlxnc2680000gn/T/.leiningen-cmdline8787230159390125176.tmp]
WARNING: :warn-on-reflection is deprecated; use :global-vars.
Compiling clojure.java.browse
Compiling compliment.sources.class-members
Reflection warning, compliment/sources/class_members.clj:216:33 - call to split can't be resolved.
Compiling neko.ui.listview
Compiling compliment.sources
Compiling clojure.data
Compiling clojure.tools.nrepl.middleware.interruptible-eval
Reflection warning, clojure/tools/nrepl/bencode.clj:152:19 - reference to field byteValue can't be resolved.
Reflection warning, clojure/tools/nrepl/bencode.clj:152:5 - call to valueOf can't be resolved.
Reflection warning, clojure/tools/nrepl/misc.clj:17:20 - reference to field printStackTrace can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/interruptible_eval.clj:104:3 - call to java.util.concurrent.ThreadPoolExecutor ctor can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/interruptible_eval.clj:128:13 - call to execute can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/interruptible_eval.clj:146:13 - call to execute can't be resolved.
Compiling clojure.tools.nrepl.ack
Reflection warning, clojure/tools/nrepl.clj:185:14 - reference to field getPort can't be resolved.
Reflection warning, clojure/tools/nrepl.clj:186:19 - reference to field getHost can't be resolved.
Reflection warning, clojure/tools/nrepl.clj:190:36 - reference to field getScheme can't be resolved.
Reflection warning, clojure/tools/nrepl.clj:190:36 - reference to field toLowerCase can't be resolved.
Reflection warning, clojure/tools/nrepl/ack.clj:47:3 - reference to field close can't be resolved.
Compiling clojure.tools.nrepl.server
Reflection warning, clojure/tools/nrepl/middleware/session.clj:37:54 - call to append can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/session.clj:38:33 - call to append can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/session.clj:182:52 - call to write can't be resolved.
Reflection warning, clojure/tools/nrepl/server.clj:33:17 - reference to field close can't be resolved.
Reflection warning, clojure/tools/nrepl/server.clj:85:28 - call to java.net.InetSocketAddress ctor can't be resolved.
Compiling clojure.tools.nrepl.misc
Compiling compliment.sources.ns-mappings
Compiling neko.init.options
Compiling neko.listeners.adapter-view
Compiling neko.doc
Reflection warning, neko/ui/traits.clj:205:5 - call to setMargins can't be resolved.
Reflection warning, neko/ui/traits.clj:280:12 - call to android.widget.RelativeLayout$LayoutParams ctor can't be resolved.
Compiling clojure.edn
Compiling neko.resource
Compiling clojure.core.protocols
Compiling neko.-utils
Compiling clojure.tools.nrepl.helpers
Reflection warning, clojure/tools/nrepl/helpers.clj:31:37 - reference to field getAbsolutePath can't be resolved.
Reflection warning, clojure/tools/nrepl/helpers.clj:35:56 - reference to field getAbsolutePath can't be resolved.
Reflection warning, clojure/tools/nrepl/helpers.clj:38:15 - call to startsWith can't be resolved.
Reflection warning, clojure/tools/nrepl/helpers.clj:40:13 - call to substring can't be resolved.
Reflection warning, clojure/tools/nrepl/helpers.clj:41:13 - call to replaceAll can't be resolved.
Reflection warning, clojure/tools/nrepl/helpers.clj:43:9 - call to java.io.File ctor can't be resolved.
Compiling clojure.tools.nrepl.cmdline
Reflection warning, clojure/tools/nrepl/cmdline.clj:83:20 - reference to field getLocalPort can't be resolved.
Reflection warning, clojure/tools/nrepl/cmdline.clj:84:30 - reference to field getLocalPort can't be resolved.
Reflection warning, clojure/tools/nrepl/cmdline.clj:86:17 - reference to field getLocalPort can't be resolved.
Compiling clojure.zip
Compiling neko.init
Reflection warning, neko/init.clj:77:62 - reference to field getPackageName can't be resolved.
Compiling neko.listeners.text-view
Compiling clojure.java.shell
Compiling compliment.sources.namespaces-and-classes
Compiling neko.activity
Compiling neko.listeners.search-view
Compiling clojure.test
Compiling clojure.test.tap
Compiling clojure.test.junit
Compiling neko.data
Compiling clojure.template
Compiling clojure.walk
Compiling neko.threading
Compiling neko.compliment.android-resources
Reflection warning, neko/compliment/android_resources.clj:38:34 - reference to field getName can't be resolved.
Reflection warning, neko/compliment/android_resources.clj:38:34 - reference to field getName can't be resolved.
Reflection warning, neko/compliment/android_resources.clj:37:23 - reference to field getDeclaredFields can't be resolved.
Reflection warning, neko/compliment/android_resources.clj:81:47 - call to get can't be resolved.
Compiling neko.ui.adapters
Compiling clojure.xml
Compiling neko.listeners.dialog
Compiling clojure.tools.nrepl.bencode
Compiling complete.core
Reflection warning, complete/core.clj:38:14 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:38:14 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:37:45 - reference to field getMethods can't be resolved.
Reflection warning, complete/core.clj:44:5 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:44:5 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:43:24 - reference to field getMethods can't be resolved.
Reflection warning, complete/core.clj:43:44 - reference to field getDeclaredFields can't be resolved.
Reflection warning, complete/core.clj:47:9 - call to endsWith can't be resolved.
Reflection warning, complete/core.clj:48:63 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:48:52 - call to endsWith can't be resolved.
Reflection warning, complete/core.clj:49:32 - reference to field getPath can't be resolved.
Reflection warning, complete/core.clj:48:32 - call to java.io.File ctor can't be resolved.
Reflection warning, complete/core.clj:52:9 - call to endsWith can't be resolved.
Reflection warning, complete/core.clj:54:16 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:54:16 - reference to field getName can't be resolved.
Reflection warning, complete/core.clj:53:53 - call to java.util.jar.JarFile ctor can't be resolved.
Reflection warning, complete/core.clj:59:21 - reference to field getPath can't be resolved.
Reflection warning, complete/core.clj:59:11 - call to replace can't be resolved.
Reflection warning, complete/core.clj:59:21 - reference to field getPath can't be resolved.
Reflection warning, complete/core.clj:59:11 - call to replace can't be resolved.
Reflection warning, complete/core.clj:58:30 - call to java.io.File ctor can't be resolved.
Reflection warning, complete/core.clj:64:43 - call to endsWith can't be resolved.
Reflection warning, complete/core.clj:64:74 - call to contains can't be resolved.
Reflection warning, complete/core.clj:64:43 - call to endsWith can't be resolved.
Reflection warning, complete/core.clj:64:74 - call to contains can't be resolved.
Reflection warning, complete/core.clj:68:3 - call to replace can't be resolved.
Reflection warning, complete/core.clj:68:3 - call to replace can't be resolved.
Reflection warning, complete/core.clj:92:11 - call to contains can't be resolved.
Reflection warning, complete/core.clj:93:11 - call to contains can't be resolved.
Reflection warning, complete/core.clj:98:30 - call to split can't be resolved.
Reflection warning, complete/core.clj:108:15 - call to contains can't be resolved.
Reflection warning, complete/core.clj:124:69 - call to startsWith can't be resolved.
Reflection warning, complete/core.clj:124:69 - call to startsWith can't be resolved.
Compiling compliment.core
Compiling clojure.java.browse-ui
Compiling neko.find-view
Compiling clojure.string
Compiling neko.notify
Compiling neko.log
Compiling neko.ui.menu
Compiling neko.compilation
Compiling neko.ui.mapping
Compiling neko.data.sqlite
Compiling neko.listeners.view
Compiling neko.application
Compiling neko.compliment.ui-widgets-and-attributes
Compiling clojure.reflect
Compiling clojure.set
Compiling com.example.clojure.app.main
Compiling neko.ui.traits
Compiling compliment.context
Compiling clojure.instant
Compiling neko.debug
Compiling clojure.tools.nrepl
Compiling clojure.inspector
Compiling compliment.utils
Compiling neko.dialog.alert
Compiling clojure.core
Compiling clojure.java.javadoc
Compiling clojure.main
Compiling neko.action-bar
Compiling clojure.tools.nrepl.middleware.session
Compiling clojure.java.io
Compiling neko.context
Compiling clojure.tools.nrepl.transport
Compiling clojure.stacktrace
Compiling clojure.pprint
Compiling neko.ui
Compiling clojure.repl
Compiling clojure.tools.nrepl.middleware.pr-values
Compiling clojure.uuid
Compilation succeeded.
Creating DEX....
/Applications/Android Studio.app/sdk/build-tools/android-4.2.2/dx --dex --no-optimize --output /Users/andre/src/clojure/app/target/classes.dex /Users/andre/src/clojure/app/target/classes /Applications/Android Studio.app/sdk/tools/support/annotations.jar /Users/andre/.m2/repository/neko/neko/3.0.0-preview1/neko-3.0.0-preview1.jar /Users/andre/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar /Users/andre/.m2/repository/android/tools.nrepl/0.2.0-bigstack/tools.nrepl-0.2.0-bigstack.jar /Users/andre/.m2/repository/compliment/compliment/0.0.2/compliment-0.0.2.jar /Users/andre/.m2/repository/org/clojure-android/clojure/1.5.1-jb/clojure-1.5.1-jb.jar

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$anim.class
...while processing com/example/clojure/app/R$anim.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$attr.class
...while processing com/example/clojure/app/R$attr.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$drawable.class
...while processing com/example/clojure/app/R$drawable.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$id.class
...while processing com/example/clojure/app/R$id.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$layout.class
...while processing com/example/clojure/app/R$layout.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R$string.class
...while processing com/example/clojure/app/R$string.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/R.class
...while processing com/example/clojure/app/R.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/SplashActivity$1.class
...while processing com/example/clojure/app/SplashActivity$1.class

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/example/clojure/app/SplashActivity.class
...while processing com/example/clojure/app/SplashActivity.class
9 warnings
Crunching resources...
/Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt crunch -v -S /Users/andre/src/clojure/app/res -C /Users/andre/src/clojure/app/target/res
Crunching PNG Files in source dir: /Users/andre/src/clojure/app/res
To destination dir: /Users/andre/src/clojure/app/target/res
Packaging resources...
/Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt package --no-crunch -f --debug-mode --auto-add-overlay -M /Users/andre/src/clojure/app/AndroidManifest.xml -S /Users/andre/src/clojure/app/target/res -S /Users/andre/src/clojure/app/res -A /Users/andre/src/clojure/app/assets -I /Applications/Android Studio.app/sdk/platforms/android-15/android.jar -F /Users/andre/src/clojure/app/target/app.ap_ --generate-dependencies
Creating APK...
Adding resource libraries:  (#<File /Users/andre/.m2/repository/org/clojure-android/clojure/1.5.1-jb/clojure-1.5.1-jb.jar>)
Signing APK...
jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore /Users/andre/.android/debug.keystore -storepass android -keypass android /Users/andre/src/clojure/app/target/app-debug-unaligned.apk androiddebugkey
Aligning APK...
/Applications/Android Studio.app/sdk/tools/zipalign 4 /Users/andre/src/clojure/app/target/app-debug-unaligned.apk /Users/andre/src/clojure/app/target/app-debug.apk
/Applications/Android Studio.app/sdk/platform-tools/adb devices
List of devices attached
4d00671879193101    device

Installing APK...
/Applications/Android Studio.app/sdk/platform-tools/adb -s 4d00671879193101 install -r /Users/andre/src/clojure/app/target/app-debug.apk
4053 KB/s (2178251 bytes in 0.524s)
    pkg: /data/local/tmp/app-debug.apk
Success

Launching APK...
/Applications/Android Studio.app/sdk/platform-tools/adb -s 4d00671879193101 shell am start -n com.example.clojure.app/.SplashActivity
Starting: Intent { cmp=com.example.clojure.app/.SplashActivity }
Binding device port 9999 to local port 9999 ...
/Applications/Android Studio.app/sdk/platform-tools/adb -s 4d00671879193101 forward tcp:9999 tcp:9999
alexander-yakushev commented 10 years ago

Wait... Which version of JDK do you use? It should be 6.

alcarvalho commented 10 years ago

Oh, I'm so sorry! I've set my system to use javac 6 but the java was pointing to 7. It worked with normal Android, but, of course, not with clojure.

alexander-yakushev commented 10 years ago

Yeah, that version thing is tricky, I tried to use java6-compatible mode but it didn't work either. So, does it work correctly now?

alcarvalho commented 10 years ago

Yes, perfectly! Thank you very much!

alexander-yakushev commented 10 years ago

You are welcome, Andre! Feel free to ping me if anything else occurs.

xrd commented 10 years ago

Can someone document exactly what steps they used to fix this? I tried to use java6 on OSX by explicitly setting the path in my shell to the older version:

$ export PATH=/System/Library/Frameworks/JavaVM.framework/Commands:$PATH
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

But, now I cannot run lein droid build

...
Exception in thread "main" java.lang.UnsupportedClassVersionError: neko/ui/adapters/InterchangeableListAdapter : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
 ...

I gather this is an incompatibility with java. Do I need to clear a cache for the lein droid task; were there libraries compiled using java7 that need to be recompiled? I am new to clojure and lein and don't know where to look.

xrd commented 10 years ago

So, more information:

If I use the JDK 1.6 and add this line to my project.clj file:

:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]

Then I successfully get it to compile.

However, it still won't run, crashes with:

Unable to instantiate activity ComponentInfo{com.sometest/com.sometest.SplashActivity}:...).

This command tells me something is wrong:

dexdump target/SomeTest-debug.apk | grep Splash

It returns nothing, so I assume it is not compiling properly.

xrd commented 10 years ago

After reading a few other issues here and the wiki I tried downgrading to neko 3.0.0-beta5 and lein-droid 0.2.0-beta2. I was able to get it to compile and include the SplashActivity in the DEX. I used this in my project.clj file:

:dependencies [[org.clojure-android/clojure "1.5.1-jb" :use-resources true]
             [neko/neko "3.0.0-beta5"]]

And, also in my ~/.lein/profiles.clj

{:user {:plugins [ [lein-droid "0.2.0-beta2"] ]}}

I can get the app to load partially but then crashes: I get this when using adb logcat

E/AndroidRuntime( 2743): FATAL EXCEPTION: main
E/AndroidRuntime( 2743): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.stuff.clojuroid/org.stuff.clojuroid.MyActivity}: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to android.os.Handler
E/AndroidRuntime( 2743):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
E/AndroidRuntime( 2743):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 2743):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 2743):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 2743):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2743):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2743):    at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 2743):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2743):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2743):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2743):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 2743):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2743): Caused by: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to android.os.Handler
E/AndroidRuntime( 2743):    at neko.threading$on_ui_STAR_.invoke(threading.clj:60)
E/AndroidRuntime( 2743):    at org.stuff.clojuroid.main$MyActivity_onCreate$fn__2011.invoke(main.clj:9)
E/AndroidRuntime( 2743):    at org.stuff.clojuroid.main$MyActivity_onCreate.invoke(main.clj:6)
E/AndroidRuntime( 2743):    at org.stuff.clojuroid.MyActivity.onCreate(Unknown Source)
E/AndroidRuntime( 2743):    at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 2743):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 2743):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 2743):    ... 11 more
W/ActivityManager(  297):   Force finishing activity org.stuff.clojuroid/.MyActivity
W/ActivityManager(  297): Activity pause timeout for ActivityRecord{538a7410 org.stuff.clojuroid/.MyActivity}
xrd commented 10 years ago

My repository is here: https://github.com/xrd/lein-droid

alexander-yakushev commented 10 years ago

Hello Chris,

If you want to try using JDK6, then you should probably take lein-droid 0.2.0-beta3. As far as I remember, that is the correct version.

Also JDK6 is not fully compatible with latest Android Build Tools from my experience. Can you by chance update to JDK7 and try using latest releases of lein-droid and neko?

xrd commented 10 years ago

Thanks for the response. I would prefer to use JDK7, but thought perhaps JDK6 was the only version supported. That must have been a comment from these issues that is now outdated.

I tried to compile using JDK7:

$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

But, I still get this message:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.stuff.clojuroid/org.stuff.clojuroid.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "org.stuff.clojuroid.SplashActivity" on path: DexPathList[[zip file "/data/app/org.stuff.clojuroid-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.stuff.clojuroid-1, /vendor/lib, /system/lib]]

I tried to make sure I was up to date with lein-droid and neko. I am using the latest tags from the github repo:

~/.lein/profiles.clj

{:user {:plugins [ [lein-droid "0.2.0-preview3"] ]}}
...

project.clj

  :dependencies [[org.clojure-android/clojure "1.5.1-jb" :use-resources true]
                 [neko/neko "3.0.0-preview3"]]

Do these look correct?

If I use these, I get a strange compile error;

$ lein droid doall
Retrieving lein-droid/lein-droid/0.2.0-preview3/lein-droid-0.2.0-preview3.pom from clojars
Retrieving lein-droid/lein-droid/0.2.0-preview3/lein-droid-0.2.0-preview3.jar from clojars
java.lang.Exception: Error loading /home/unlogic/clojure/android/splashtest/project.clj
    at leiningen.core.project$read$fn__3326.invoke(project.clj:696)
    at leiningen.core.project$read.invoke(project.clj:693)
    at leiningen.core.project$read.invoke(project.clj:703)
    at leiningen.droid.utils$read_project.invoke(utils.clj:133)
    at leiningen.droid.utils$proj.invoke(utils.clj:181)
    at leiningen.droid$droid.doInvoke(droid.clj:89)
    at clojure.lang.RestFn.invoke(RestFn.java:423)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.core$apply.invoke(core.clj:619)
    at leiningen.core.main$resolve_task$fn__3029.doInvoke(main.clj:189)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at leiningen.core.main$apply_task.invoke(main.clj:230)
    at leiningen.core.main$resolve_and_apply.invoke(main.clj:234)
    at leiningen.core.main$_main$fn__3092.invoke(main.clj:303)
    at leiningen.core.main$_main.doInvoke(main.clj:290)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.core$apply.invoke(core.clj:617)
    at clojure.main$main_opt.invoke(main.clj:335)
    at clojure.main$main.doInvoke(main.clj:440)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at clojure.lang.Var.invoke(Var.java:427)
    at clojure.lang.AFn.applyToHelper(AFn.java:172)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: /home/unlogic/clojure/android/splashtest/project.clj (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at java.io.FileInputStream.<init>(FileInputStream.java:101)
    at clojure.lang.Compiler.loadFile(Compiler.java:7017)
    at clojure.lang.RT$3.invoke(RT.java:318)
    at leiningen.core.project$read$fn__3326.invoke(project.clj:694)
    ... 31 more
xrd commented 10 years ago

Alexander, this is all in my repo:

https://github.com/xrd/lein-droid

Can you pull this and run lein droid doall and see if it works on your machine?

alexander-yakushev commented 10 years ago

Those versions are not the latest. Please try with the following set:

JDK7 Android Build tools 19 lein-droid 0.2.0 Neko 3.0.0

Also try both with and without line :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"].

xrd commented 10 years ago

Thanks. This gist has my settings, and I still get the same error:

https://gist.github.com/xrd/8359002

Compiling neko.application

Compiling neko.compliment.ui-widgets-and-attributes

Exception in thread "main" java.lang.RuntimeException: No such var: mapping/get-keyword-mapping, compiling:(neko/compliment/ui_widgets_and_attributes.clj:31:36)
alexander-yakushev commented 10 years ago

Have you done lein clean before?

xrd commented 10 years ago

That worked! I can successfully load my sample project now. Thank you!

On Fri, Jan 10, 2014 at 10:13 AM, Alexander Yakushev < notifications@github.com> wrote:

Have you done lein clean before?

— Reply to this email directly or view it on GitHubhttps://github.com/clojure-android/lein-droid/issues/61#issuecomment-32050966 .

Chris Dawson 971-533-8335 Human potential, travel and entrepreneurship: http://webiphany.com/ Check out Teddy Hyde, Android editor for GitHub (especially Jekyll blogs): bit.ly/16BL13z