HaO 2015-03-24: My intention is to collect reports building great Androwish with the aim to get stand-alone APK files with custom contents.
Contributions and ideas welcome.
Warning: I am an absolute beginner on Android.
Starting point is the description by chw at [L1 ] and the following quote from wiki page Androwish:
chw please fetch the sources (the big .tar.bz2), unpack it, have Android SDK and NDK installed, don't use Eclipse, adapt local.properties to where you've installed Android SDK, have your PATH properly set so that ndk-build can do its job, then invoke "ant debug", be patient, and you'll finally will have bin/AndroWish-debug.apk ready to be installed onto your device. I have never verified the build process in combination with Eclipse. Once upon a time, I did my very first steps using the tips from the SDL documentation regarding Android.
When you want to wrap your own app written as Tcl code, you should add it below assets/app, have the launching script as main.tcl, fiddle the toplevel AndroidManifest.xml to have your app/class name in, remove that AndroWishScript/Launcher stuff from the manifest (since not needed for a standalone app), derive your app main class (yes, some Java required) from src/tk/tcl/wish/AndroWish.java, e.g.
import tk.tcl.wish.AndroWish; public class TclTkRules extends AndroWish {}
fiddle the res directory with a new really kooool icon and title for your app.
Windows build stopped with ndk-build with a "command line to long" error. I tried cmd.exe and cygwin shell, same result.
Failed for me due to a to old clib.
I installed VirtualBox on my Windows 8.1 and OpenSuSE 13.2 64 bit with 100GB HarDisk and 4GB Ram.
Activate Java 7 (e.g. 1.7):
update-alternatives --config java -> 1.7 update-alternatives --config javac -> 1.7 update-alternatives --config xml-commons-apis -> xerces-j2-xml-apis.jar
Set up Android build system:
cd ~ mkdir android cd android mkdir download
Downloaded in ~/android/download:
Unpack and install, androwish in folder "androwish" for easier access
cd ~/android tar xvzf download/android-sdk_r24.1.2-linux.tgz chmod +x download/android-ndk-r10d-linux-x86_64.bin download/android-ndk-r10d-linux-x86_64.bin tar xvzf download/androwish-e2aee3ea2ea718e7.tar.gz mv androwish-e2aee3ea2ea718e7 androwish
Open Android SDK manager:
~/android/android-sdk-linux/tools/android sdk -> Select Google APIs ARM EABI v7a System Image -> Unselect all other system images
Prepare build and let "android" create "local.properties":
export PATH=$PATH:~/android/android-sdk-linux/tools:~/android/android-ndk-r10d cd androwish android update project -p . --target 1
On "ant debug", I had the following build error I could not solve:
[exec] [armeabi] Compile thumb : tiff_tkimg <= tif_predict.c [exec] /tmp/ccTUdnr3.s: Assembler messages: [exec] /tmp/ccTUdnr3.s: Error: unaligned opcodes detected in executable segment [exec] make: *** [obj/local/armeabi/objs/tiff_tkimg/libtiff/tif_predict.o] Error 1
This is in jni/tiff. So I deleted the tkimg and jni/tiff folders:
rm -rf jni/tkimg jni/tiff
Now, an "ant debug" succeeds for me. The result is in "androwish/bin/AndroWish-debug.apk
Great, thank you, Cristian !
It is perhaps me, but I always try to get small packages with as less as possible included. So I deleted packages I know and I don't need in this project:
cd jni rm -rf 3dcanvas blt curl expect itk jpeg libxml2 nsf TclCurl tclral tcludp tclx tclxml\ tdom tiff Tix tkimg tktable tktreectrl vu xotcl zint cd jni/tcl-pkgs rm -rf tdbcmysql1.0.3 tdbcsqlite3-1.0.3 itcl4.0.3 sqlite3.8.8.3 tdbcodbc1.0.3\ thread2.7.2 tdbc1.0.3 tdbcpostgres1.0.3 cd androwish rm -rf tkchat cd assets rm -rf bin blt2.4 bwidget1.9.7 Canvas3d1.2.1 expect5.45.2 gridplus2.10 icons1.2 itcl4.0.3\ itk4.0.1 iwidgets4.1 nsf2.0.0 pdf4tcl08 ral0.11.2 ralutil0.11.2 sqlite3 TclCurl7.22.0\ tcllib1.16 tclsoap1.6.8 tclws2.3.8 tclx8.4.1 Tclxml3.2 tdbc1.0.3 tdbcsqlite3-1.0.3 tdom0.8\ thread2.7.2 tkimg1.4.3, tklib0.6, tksqlite0.5.11, tktable2.11 treectrl2.4.1 vu2.3
This results in an androwish size of 17MB, so 6 MB less than the full package.
Now, the script tree of the application is copied to assets/app and a main.tcl is there to be started:
cd assets mkdir app cp <sw>/main.tcl .
An "ant debug" results in a starkit-like apk file.
In "./AndroidManifest.xml", delete all intent filter from this (keep the first, app will not show without):
<intent-filter> <action android:name="android.intent.action.VIEW" /> ...
Delete all activities "AndroWishScript0" to "AndroWishScript3":
<activity android:name="tk.tcl.wish.AndroWishScript0" ...
In "./AndroidManifest.xml", you may delete any permission, but:
<uses-permission android:name="android.permission.INTERNET" />
Application will directly terminate if not present.
In "./AndroidManifest.xml", you should change the package name to be different to androwish. Otherwise, the applications may not be installed together. This is not terminated jet and any help appreciated. So far:
In "./AndroidManifest.xml"
package="de.elmicron.hibiscan"
where "de.elmicron.hibiscan" is my internet domain and the application name as last component. This should be adopted on request.
The derived class definition is in file "src/tk/tcl/wish/HIBIScan.java" and contains:
import tk.tcl.wish.AndroWish; public class HIBIScan extends AndroWish {}
This must be referenced somewhere in the AndrowishManifest.xml but did not find out jet where. More tomorrow...
Change the AppName in res/values/strings.xml
Change the Androwish icons in res/drawable-*/androwish.png (Resolutions: 72x72, 48x48, 96x96, 144x144).