lein droid build fails on "Hello world" sample project

133 views
Skip to first unread message

Frédéric Bourgine

unread,
Dec 9, 2015, 7:16:29 PM12/9/15
to clojure-android

Hi,

I've created a new clojure android project using the following command:
lein new droid my-droid my.droid


I've modified my-droid/project.clj, just to indicate the android-sdk path and when I tried to build the project using: lein droid build the following error occurs:
error: package neko does not exist


In fact the compilation error arise when trying to java compile the SplashActivity.java generated by thelein-droid plugin.

Hereafter the SplashActivity.java file:

package my.droid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import neko.App;

import my.droid.R;

public class SplashActivity extends Activity {

    private static boolean firstLaunch = true;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);

        if (firstLaunch) {
            firstLaunch = false;
            setupSplash();
            App.loadAsynchronously("my.droid.MainActivity",
                                   new Runnable() {
                                       @Override
                                       public void run() {
                                           proceed();
                                       }});
        } else {
            proceed();
        }
    }

    public void setupSplash() {
        setContentView(R.layout.splashscreen);

        TextView appNameView = (TextView)findViewById(R.id.splash_app_name);
        appNameView.setText(R.string.app_name);

        Animation rotation = AnimationUtils.loadAnimation(this, R.anim.splash_rotation);
        ImageView circleView = (ImageView)findViewById(R.id.splash_circles);
        circleView.startAnimation(rotation);
    }

    public void proceed() {
        startActivity(new Intent("my.droid.MAIN"));
        finish();
    }

}

The compilation error occurs at line 10 when trying to import neko.App class. However neko is included in project dependency.
Hereafter the project .clj file:

(defproject my-droid/my-droid "0.1.0-SNAPSHOT"
  :description "FIXME: Android project description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :global-vars {*warn-on-reflection* true}

  :source-paths ["src/clojure" "src"]
  :java-source-paths ["src/java"]
  :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
  :plugins [[lein-droid "0.4.3"]]

  :dependencies [[org.clojure-android/clojure "1.7.0-r2"]
                 [neko/neko "4.0.0-alpha5"]]
  :profiles {:default [:dev]

             :dev
             [:android-common :android-user
              {:dependencies [[org.clojure/tools.nrepl "0.2.10"]]
               :target-path "target/debug"
               :android {:aot :all-with-unused
                         :rename-manifest-package "my.droid.debug"
                         :manifest-options {:app-name "my-droid (debug)"}}}]
             :release
             [:android-common
              {:target-path "target/release"
               :android
               {;; :keystore-path "/home/user/.android/private.keystore"
                ;; :key-alias "mykeyalias"
                ;; :sigalg "MD5withRSA"

                :ignore-log-priority [:debug :verbose]
                :aot :all
                :build-type :release}}]}

  :android {;; Specify the path to the Android SDK directory.
            :sdk-path "D:/Users/Frederic/Tools/android-sdk"

            ;; Try increasing this value if dexer fails with
            ;; OutOfMemoryException. Set the value according to your
            ;; available RAM.
            :dex-opts ["-JXmx4096M" "--incremental"]

            :target-version "15"
            :aot-exclude-ns ["clojure.parallel" "clojure.core.reducers"
                             "cider.nrepl" "cider-nrepl.plugin"
                             "cider.nrepl.middleware.util.java.parser"
                             #"cljs-tooling\..+"]})


I sure I doing something wrong but I didn't find any way to fix it.


I am using the following leiningen version:
Leiningen 2.5.1 on Java 1.7.0_51 Java HotSpot(TM) 64-Bit Server VM



Alexander Yakushev

unread,
Dec 9, 2015, 7:23:41 PM12/9/15
to clojure-android
I've just tried to do the same, and it worked. I feel this might be Windows-related. You should run `DEBUG=1 lein droid doall` and post your build log.

Best regards,
Alex

Frédéric Bourgine

unread,
Dec 11, 2015, 4:34:28 PM12/11/15
to clojure-android
Hi Alex,

Yes it seems related to Windows.

After setting `DEBUG=1`, I run `lein droid doall`.
Hereafter the log:
```
D:\Users\Frederic\Data\NightcodeProjects\my-droid>lein droid doall
CLASSPATH=C:\Users\Frédéric\.lein\self-installs\leiningen-2.5.1-standalone.jar
(Warning: profile :android-common not found.)
(Warning: profile :android-user not found.)
Applying task droid to [doall]
Generating manifest...
Merging secondary manifests: (#<File D:\Users\Frederic\Data\NightcodeProjects\my
-droid\target\debug\aar-extracted\com.android.support_multidex_aar_1.0.0\Android
Manifest.xml>)
Generating R.java files...
D:\Users\Frederic\Tools\android-sdk\build-tools\23.0.2\aapt.exe package -f -m -M
 D:\Users\Frederic\Data\NightcodeProjects\my-droid\target\debug\AndroidManifest.
xml -S D:\Users\Frederic\Data\NightcodeProjects\my-droid\target\debug\res -S D:\
Users\Frederic\Data\NightcodeProjects\my-droid\res -S D:\Users\Frederic\Data\Nig
htcodeProjects\my-droid\target\debug\aar-extracted\com.android.support_multidex_
aar_1.0.0\res -I D:\Users\Frederic\Tools\android-sdk\platforms\android-15\androi
d.jar -J D:\Users\Frederic\Data\NightcodeProjects\my-droid\target\debug\gen --ou
tput-text-symbols D:\Users\Frederic\Data\NightcodeProjects\my-droid\target\debug
\gen --auto-add-overlay --generate-dependencies

Running javac with [-target 1.6 -source 1.6 -Xlint:-options @C:\Users\FRDRIC~1\A
ppData\Local\Temp\.leiningen-cmdline4965496590100758286.tmp]
(Warning: profile :android-common not found.)
(Warning: profile :android-user not found.)
Compiling 3 source files to D:\Users\Frederic\Data\NightcodeProjects\my-droid\ta
rget\debug\classes
D:\Users\Frederic\Data\NightcodeProjects\my-droid\src\java\my\droid\SplashActivi
ty.java:10: error: package neko does not exist
import neko.App;
           ^
D:\Users\Frederic\Data\NightcodeProjects\my-droid\src\java\my\droid\SplashActivi
ty.java:25: error: cannot find symbol
            App.loadAsynchronously("my.droid.MainActivity",
            ^
  symbol:   variable App
  location: class SplashActivity
2 errors
Compilation of Java sources(lein javac) failed.
```
Regards

Frédéric

Alexander Yakushev

unread,
Dec 12, 2015, 3:35:00 AM12/12/15
to clojure...@googlegroups.com
It might be related to recent changes in lein-droid with classpath construction. Please try changing lein-droid version to 0.4.1 and see if that helps.

--
You received this message because you are subscribed to the Google Groups "clojure-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-andro...@googlegroups.com.
To post to this group, send email to clojure...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-android.
For more options, visit https://groups.google.com/d/optout.

Frédéric Bourgine

unread,
Dec 15, 2015, 6:20:56 PM12/15/15
to clojure-android
Hi Alex,

Unfortunately, same compilation errors occur with 0.4.1 version.

Fred

Frédéric Bourgine

unread,
Feb 3, 2016, 4:34:07 PM2/3/16
to clojure-android

Hi Alex,

After some tests using lein droid on Windows, I probably found the reason of the compilation issue.

The neko.jar can not be resolved because my .m2 directory (i.e. the directory containing artefacts downloaded by leiningen) is located in a parent directory which name contains some characters with accent. 
When I try to do the same on an other account (which username doesn't contain accented characters), the compilation completes without any error.

Reply all
Reply to author
Forward
0 new messages