Updated 2016-10-17 11:05:15 by nb

This page was moved to [1].

Here, it will be deleted soon.

I hope this is ok for anybody. I only want to maintain one page...

Thank you,


MG 27-09-2016 I am, once again, trying my clueless hand at building AndroWish on Windows. For anyone else trying (and for me in the future, as I'll forget in 10 minutes;), I'm going to try and document everything I'm doing, up to wherever I get stuck (or, more optimistically, where it works;). I'm following the link above, and muddling through with further info from a couple of other sources.

I'm putting everything in E:\android-build\ for simplicity, and the dir names for the various downloads reflect the latest versions as of today

So, here's what I've done so far:

  1. Download the Android SDK. From https://developer.android.com/studio/index.html download the latest version under "Get just the command line tools" - currently android-sdk_r24.4.1-windows.zip
  2. Unpack the SDK (E:\android-build\android-sdk-windows), run "SDK Manager.exe", and click Install Packages with the selected items. This'll take a while.
  3. Download the NDK from https://developer.android.com/ndk/downloads/index.html (Windows 32- or 64-bit, as appropriate), extract to E:\android-build\android-ndk-r12b
  4. Download the latest Apache Ant .zip archive from http://ant.apache.org/bindownload.cgi and extract to E:\android-build\apache-ant-1.9.7
  5. Download AndroWish source from http://www.androwish.org/download/index.html and extract to E:\android-build\androwish-a05b615f58
  6. Add the following to your path: E:\android-build\apache-ant-1.9.7\bin;E:\android-build\android-sdk-windows\tools;E:\android-build\android-ndk-r12b
  7. Start -> Run, type "cmd.exe" to open the Command Prompt. In the prompt, type "e:" to switch to the E drive (been so long since I've used the command prompt much that I had to look this up, since "cd" won't do it;) then "cd e:\android-build\androwish-a05b615f58". Using Tab for path completion is your friend (androwish-<tab>).
  8. As per the docs above, I tried "android update project", and got an error that said I needed to include a path. "android update project --path e:\android-build\androwish-a05b615f58" then gave me an error that there was no target specified. Some Googling gave the solution:
  9. Type "android list targets". It'll list at least two with the default SDKs you installed earlier via "SDK Manager.exe" - the latest Android API (v24 for me), and the same again with some Google APIs (Google USB Driver). The first line for each listed is: id: X, or "YYYYY". You can specify either X or YYYYY for --target. For me, that's either "1" or "android-24". So:
  10. android update project --path e:\android-build\androwish-a05b615f58 --target 1
  11. Run "ant debug". And this is where I hit a problem. It fails with the following error:
e:\android-build\androwish-a05b615f58>ant debug
Unable to locate tools.jar. Expected to find it in C:\Program Files (x86)\Java\j
Buildfile: e:\android-build\androwish-a05b615f58\build.xml



 [checkenv] Android SDK Tools Revision 25.2.2
 [checkenv] Installed at E:\android-build\android-sdk-windows

     [echo] Project Name: AndroWish
  [gettype] Project Type: Application






e:\android-build\androwish-a05b615f58\custom_rules.xml:82: Execute failed: java.io.IOException: Cannot run program "ndk-build" (in directory "e:\android-build\androwish-a05b615f58"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:854)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 24 more

Total time: 0 seconds

There are ndk-build.cmd scripts in both E:\android-build\android-ndk-r12b (which is in my path) and E:\android-build\android-ndk-r12b\build (the former simply runs the latter). I've tried putting the \build dir in my path instead/as well, but get the same result.

I then tried running "ndk-build" manually, which gave me separate errors:
jni/tcl-pkgs/itcl4.0.5/Android.mk:13: jni/tcl-pkgs/itcl4.0.5/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/sqlite3.14.1/Android.mk:13: jni/tcl-pkgs/sqlite3.14.1/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/tdbc1.0.4/Android.mk:13: jni/tcl-pkgs/tdbc1.0.4/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/thread2.8.0/Android.mk:13: jni/tcl-pkgs/thread2.8.0/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/itcl4.0.5/Android.mk:13: jni/tcl-pkgs/itcl4.0.5/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/sqlite3.14.1/Android.mk:13: jni/tcl-pkgs/sqlite3.14.1/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/tdbc1.0.4/Android.mk:13: jni/tcl-pkgs/tdbc1.0.4/../../tcl-config.mk: No such file or directory
jni/tcl-pkgs/thread2.8.0/Android.mk:13: jni/tcl-pkgs/thread2.8.0/../../tcl-config.mk: No such file or directory
make: *** No rule to make target `jni/tcl-pkgs/thread2.8.0/../../tcl-config.mk'.

Hrm. That only happens for a few packages, and they're all in the tcl-pkgs error. That seems curious. Opening up those Android.mk files, they all have the lines
tcl_path := $(LOCAL_PATH)/../..

include $(tcl_path)/tcl-config.mk

LOCAL_ADDITIONAL_DEPENDENCIES += $(tcl_path)/tcl-config.mk

which is the wrong path. Changing all of those tcl_path lines to
tcl_path := $(LOCAL_PATH)/../../tcl

gets around that error, and it starts building all the packages. Guessing this is an AndroWish issue in the current version?

After a lot of successful builds along the lines of the first few shown below, it then errors:
[armeabi] Compile thumb  : crypto_tls <= v3_pku.c
[armeabi] Compile thumb  : crypto_tls <= v3_pmaps.c
[armeabi] Compile thumb  : crypto_tls <= v3_prn.c
[armeabi] Compile thumb  : crypto_tls <= v3_purp.c
[armeabi] Compile thumb  : crypto_tls <= v3_skey.c
[armeabi] Compile thumb  : crypto_tls <= v3_sxnet.c
[armeabi] Compile thumb  : crypto_tls <= v3_utl.c
[armeabi] Compile thumb  : crypto_tls <= v3err.c
[armeabi] SharedLibrary  : libcrypto_tls.so
arm-linux-androideabi-g++: error: CreateProcess: No such file or directory
make: *** [obj/local/armeabi/libcrypto_tls.so] Error 1

And at this point I'm at a loss again. Anyone with more experience have any ideas?

chw 2016-09-27: the path issue with the tcl_path macro should have been resolved by one of the ant targets -pre-build-links and -pre-build-copies. The first makes some symbolic links, the second physical file copies depending on the support of the development system with respect to symbolic links. So you're on Windows which I thought won't do symlink but can copy files. Well, now it seems it can't even do that, bummer (a new Windows 10 feature?). The ant rules for these operations are in custom_rules.xml in the top level directory. And maybe for Windows the ndk-build target has to execute ndk-build.cmd instead of the plain ndk-build. Regarding the problem of building LibreSSL: maybe you should ndk-build with the option V=1 in order to see more of the failing command line. Regarding the "android update project" stuff: it is IMO no good idea to build against API 24 but to install an older SDK platform with the Android SDK manager, AndroWish prefers API 15 (which is Android 4.1).

chw 2016-09-28: things become clearer now. The custom_rules.xml needed some changes which can be found in check-in http://www.androwish.org/index.html/info/68819df035980aae. However, the ndk-build breaking on LibreSSL can't be easily solved, since it hits the Windows 32768 chars command line limit. Your only option now is to leave out libressl, curl, TclCurl, and tls from your build by simply renaming the respective Android.mk files to e.g. Android.nomk and rebuild everything from scratch, and then lay back patiently hoping for the next decade either Microsoft or Google fixing their operating systems or their tools to overcome this limitation.

MG 2016-09-29 Hi chw, thanks for the quick response. I decided I'd start over with a fresh copy of the source, but this time I grabbed "AndroWish SDK package (ZIP)" instead of "Source code (tarball)". On this one, "ant debug" ran without any problem. What's the difference between the two?

I grabbed a clean copy of the Source code tarball again to give everything a fresh try there too, and applied your patch, then ran 'ant debug'. After it failed, I edited custom_rules.xml to add the V=1 arg in and re-ran, appending the output to the log, which I've put up at [2] in case it's of any interest.

(The only reason I'm building against API24 is because it's the one that was installed by default, btw - I was just trying to check whether compiling was actually possible before I started downloading other API versions, so I didn't waste time doing so if I was going to have to switch to a Linux VM for it all anyway.)

chw 2016-09-29: The purpose of the "AndroWish SDK" is to give you the skeleton of a Tcl based Android app without the tedious hassles of rebuilding the many native pieces from source. Besides the unevitable Java development kit, apache-ant and the standalone Android SDK nothing else is required, i.e. no need to install the Android NDK. With the "bones" tool of "AndroWish SDK" you're only a few mouse clicks away from a working package. More info can be found on http://www.androwish.org/index.html/wiki?name=AndroWish+SDK

In your log file, the failing command is on line 1677. The command line is more than 32000 characters long which I guess runs straight against an internal wall of the Windows operating system. Maybe overcoming this was another argument for Microsoft to offer an Ubuntu userland on top Windows 10 ;-)

chw 2016-09-30: Meanwhile it works. Google seems to have done its home work half a decade ago. Finding the pointer wasn't that easy, however. The inconsiderable small piece in the respective Android.mk is "LOCAL_SHORT_COMMANDS:=true" which makes the NDK build run on Windows, and is now part of check-in http://www.androwish.org/index.html/info/52a07071b99fa88a

MG Awesome. :) I haven't tried the short commands commit yet, but I did play around with the AWSDK package a little - the bones tool is really nice. After a little playing with that I got myself an APK. It installs nicely on my cheap tablet and shows the app icon and name properly, but doesn't run right so far - the window pops up about 90% complete taking up about 1/5th of the screen, sits like that for a second or two, then disappears and I end up back on the previous screen. That's probably an issue with my app (which I haven't started modifying in any way for Android, yet), though, so I'll have to start poking at it in an emulator tomorrow and see if I can figure out why it's doing that and what to tweak. Thanks very much for all your hard work, and your help; I'll probably be back to bug you about something else soon. ;) I'll try running the latest build with short_commands on later too and update the info I wrote above.

NB I'm also able to build using the AWSDK zip, but I fail here when trying to build the latest source and checkin..

     [exec] Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: c:\android\android-ndk-r10e/jni/Android.mk
     [exec] c:/Android/android-ndk-r10e/build/core/add-application.mk:199: *** Android NDK: Aborting...    .  Stop.

     C:\Android\androwish_e06b3cc71e\custom_rules.xml:88: exec returned: 2

I'm stuck, can't see where this is declared... Forgot to add this is on WIN7 Pro, 64bit, and Android6.0 target

chw 2016-10-03: try the information in this reference http://stackoverflow.com/questions/21158332/your-app-build-script-points-to-an-unknown-file-c-android-ndk-jni-android-mk maybe there's something wrong with NDK_PROJECT_PATH on your machine.

nb Ok, continuing on this, indeed my NDK_PROJECT_PATH pointed elsewhere... fixed and got to here.. Failed on libdropbear

/Android/android-ndk-r10e/platforms/android-9/arch-arm/usr/lib -llog -lc -lm -o C:/Android/androwish_e06b3cc71e/obj/local/armeabi/libdropbear.so, ...) failed.
     [exec] make (e=87): The parameter is incorrect.
     [exec] make.exe: *** [C:/Android/androwish_e06b3cc71e/obj/local/armeabi/lib

dropbear.so] Error 87

fixed with adding to /jni/Android.mk LOCAL_SHORT_COMMANDS := true

and adding to /jni/dropbear/Android.mk LOCAL_SHORT_COMMANDS := true

Alot of compilation and now fail here....


    [javac] Compiling 16 source files to C:\Android\androwish_e06b3cc71e\bin\classes
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] C:\Android\androwish_e06b3cc71e\src\tk\tcl\wish\AndroWish.java:1942:  error: cannot find symbol
    [javac]             n.setLatestEventInfo(mSingleton.getContext(), title, text, pi);
    [javac]              ^
[javac] symbol
method setLatestEventInfo(Context,String,String,PendingIntent)
    [javac]   location: variable n of type Notification
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 1 error
    [javac] 3 warnings

BUILD FAILED C:\Android\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:

C:\Android\android-sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.

Total time: 69 minutes 18 seconds

Here's where I'm at now...

PS Should I continue this at [3] since the top of this page says it will be deleted?

Searching, seems "setLatestEventInfo" has been removed from Marshmallow (API level 23) so currently trying with API level 15, as per above...

android update project --path c:\android\androwish_e06b3cc71e --target 1

Seems to have done it... -post-build:
   [delete] Deleting: C:\Android\androwish_e06b3cc71e\libs\armeabi\librun.so
   [delete] Deleting: C:\Android\androwish_e06b3cc71e\libs\x86\librun.so


BUILD SUCCESSFUL Total time: 29 minutes 15 seconds

NB: Also builds with API level 22