Example setup of AndroWish SDK on WIndows 10

Difference between version 8 and 10 - Previous - Next
[HaO] 2019-04-05:
Around 5 years ago, I had my last contact to great Androwish, resulting in my build experience log [http://www.androwish.org/index.html/wiki?name=Build+custom+Androwish]. At this time, Windows did not work and a VirtualBox with SuSELinux was necessary for me.

Now, it is time to come back. Here is my log of actions to set-up AndroWish SDK with my new device (Honeywell EDA50k0 with Android 7.1.1).
My PC is a Windows 10 64 bit device.

Instructions to follow by Christian:
http://www.androwish.org/index.html/wiki?name=AndroWish+SDK

**Install Java**
Java SDK 1.6 or 1.7 is requested by Christian.

I have Java8 Update 201 32 bit.
This is JRE (Java Runtime), not JDK (Java Development Kit). Remove it from Windows Programs & Functions.
Delete folders: c:\AppData\Oracle, c:\program files(x86)\java

***Install JDK 1.8 (Java 8 202), as 1.7 is out of support***

Download:
https://codenotfound.com/java-download-install-jdk-8-windows.html
Filename: jdk-8u202-windows-i586.exe

I have chosen to use the 32bit variant (for my 64 bit computer).

Instructions:
https://codenotfound.com/java-download-install-jdk-8-windows.html

Disable install option: Public JRE

***Set Windows Environment variables for Java***

Search in Windows Start: "env".
In German, the programm is called "Umgebungsvariablen dieses Kontos bearbeiten"

New: JAVA_HOME
Value: C:\Program Files (x86)\Java\jdk1.8.0_202

Edit: PATH
Add: %JAVA_HOME%\bin

***Test***

======none
cmd.exe: java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) Client VM (build 25.202-b08, mixed mode)
======

**Android command line tools for windows**

"tools" folder is: sdk-tools-windows-4333796.zip
from: https://developer.android.com/studio

Unzip to c:\android (so we get a folder c:\android\tools)

New Windows environment variables, so bones will find them (as above):

New var: ANDROID_HOME
Value: c:\android

**gradle**

gradle is automatically downloaded by bones.tcl in the last step.

But first, any android licence must be accepted:

======nonecmd.exe: cd \android\tools\bin
sdkmanager --licenses
yyyyyyy
======

-> files in folder C:\android\licenses get written

**Tcl/Tk wish version 8.5 or 8.6 (preferred)**

You need a TCL wish to start the "bones" script.
I use Ashoks TCL distribution.
For me, wish starts when I double-click on a TCL file.
This is a detail but helpful for the last step.

**Android Platform Tools**

URL:
https://developer.android.com/studio/releases/platform-tools

File: platform-tools_r28.0.2-windows.zip

Unzip to c:\android (so we get c:\Android\platform-tools)

**USB Debugging**

To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options.
On Android 4.2 and higher, the Developer options screen is hidden by default.
To make it visible, go to Settings > About phone and tap Build number seven times.
Return to the previous screen to find Developer options at the bottom.

**Install Windows USB Driver**

https://developer.android.com/studio/run/oem-usb.html

Load Google USB driver:

   * https://developer.android.com/studio/run/win-usb.html
   * File: latest_usb_driver_windows.zip

Unzip it to c:\android (getting folder c:\android\usb_driver)

Installation is described here:
https://developer.android.com/studio/run/oem-usb.html#InstallingDriver

Test:

======none
cmd.exe: cd C:\android\platform-tools
adb devices
List of devices attached
S/N      device
======

**Install Apps from unknown sources**

In Android Settings: Security->Unknown source -> yes

**Androwish SDK**

I unzipped Androwish SDK to c:\android (to get folder c:\android\AWSDK)

If your system evaluates a script with "wish" on a double click, you may added the extension ".tcl" to file "c:\android\AWSDK\tools\bones".
Then, you can start the magic maker with a double-click.

Otherwise, use a cmd window and type `wish c:\android\AWSDK\tools\bones`

I ended up with a running test application.

Thank you Christian, great job!

**Forward debug socket**

To get the tkconclient output of Androwish TCL command

======
package require tkconclient
tkconclient::start 12345
======

I have added the following batch file to set-up forwarding on Windows:

File name: adbforward.bat

Content:

======none
%ANDROID_HOME%\platform-tools\adb forward tcp:12345 tcp:12345
======

**Create a release key**

The bones possibility to create a release key did not work for me (e.g. the button "Create Keystore").
Thus, I used the method described in [http://www.androwish.org/home/wiki?name=Build+custom+Androwish].

Create a release key by (replace "elmicron" by your own name):

======none
cd C:/android
keytool -genkey -v -keystore android_elmicron.keystore -alias android_elmicron -keyalg RSA -keysize 2048 -validity 10000
======

You get promted to a keystore password and the key values. I only filled common name and Organisation. Then you get prompted to a key password. I used the same for both (mypass).

This generates the file "C:/android/android_elmicron.keystore". 

In the bones page "set build opts and apk signing", I entered:

   * Build mode: Debug: No
   * key.store: c:/android/android_elmicron.keystore
   * key.store.password: mypass
   * key.alias: android_elmicron
   * key.alias.password: mypass

Take care to use "/" slashes as path delimiter.
With this, you can build a release package.

The final APK is in "build\outputs\apk".
**Custom binary packages?**

I asked Christian, if it is possible to compile custom binary packages (own stubs-enabled c files) with AndroWish SDK.
Here is the answer (clt, 2019-05-07 title: Re: Androwish custom c module with bones.tcl ?):

In order to get the proper compiler switches and defines you should use a full AndroWish fossil checkout in this case.
Place your C code in a subdir of .../jni and add an Android.mk makefile in that subdir using one of the other many Android.mk files as starting point.

----

[APN] Thank Harald. I've been looking for a step-by-step like this.