en Documentación, GUI, Harbour, Linux

Guía de Inicio HDroidGUI


1) Download Java Development Kit (JDK) version 7 for Windows (if you have other version installed, please uninstall first):




2) Run it and accept suggested install location (at the date of this post, it is: C:\Program Files\java\jdk1.7.0_75. It will change according version number) .

3) Go to: https://developer.android.com/sdk/index.html (‘SDK Tools Only’ section, near the end of the page) and download Windows version.




4) Create the folder tree: c:\Android\sdk and install Android SDK there.

2015-03-27_113035 2015-03-27_113115 2015-03-27_113151 2015-03-27_113232


5) Run C:\Android\sdk\SDK Manager.exe and follow these directions found in android.com:



As a minimum when setting up the Android SDK, you should download the latest tools and Android platform:

Open the Tools directory and select:
Android SDK Tools
Android SDK Platform-tools
Android SDK Build-tools (highest version)

Open the first Android X.X folder (the latest version) and select:
SDK Platform
A system image for the emulator, such as
ARM EABI v7a System Image

6) Go to https://developer.android.com/tools/sdk/ndk/index.html and download Android NDK for Windows release 10d (at the time of this post) and extract in C:\Android\android-ndk-r10d

7) Go to https://github.com/alkresin/HDroidGUI and click on ‘Download ZIP’. Unzip on C:\Android\projects\HDroidGUI



8) Edit the file C:\Android\projects\HDroidGUI\setenv.bat and change paths according to the location of the tools you’ve installed. With the versions installed at the time of this post, it should look as this:

@set ANDROID_HOME=c:\Android\sdk
@set BUILD_TOOLS=%ANDROID_HOME%\build-tools\21.1.2
@set NDK_HOME=c:\Android\android-ndk-r10d
@set JAVA_HOME=c:\Program Files (x86)\Java\jdk1.7.0_75

@set ADB=%ANDROID_HOME%\platform-tools\adb.exe
@set ANDROID_JAR=%ANDROID_HOME%/platforms/android-21/android.jar

@set HRB_BIN=c:\hb32\bin
@set HRB_INC=c:\hb32\include


@call setenv

call "%JAVA_HOME%/bin/javac" -d libs -cp %ANDROID_JAR% -sourcepath src src/su/harbour/hDroidGUI/*.java
@if errorlevel 1 goto end

@rem jar cvf hdroidgui.jar -C libs .


– Please, be careful: Path names changes with tools versions!
– JAVA_HOME could be different according your Windows version and language. Please, check it.
– I have Harbour installed at c:\hb32. If that is not your path, please change it as needed. If you do not have Harbour installed, please check it.

Download from:
and unzip at c:\hb32

9) Build HDROIDGUI: C:\Android\projects\HDroidGUI\BuildAll.bat



10) Now, we will download a sample project called HDCALCUL. Go to https://github.com/alkresin/hdcalcul and click on ‘Download ZIP’. Unzip on c:\Android\projects\hdcalcul

View c:\Android\projects\hdcalcul\setenv.bat

@set HDROIDGUI=\android\projects\hdroidgui
@call %HDROIDGUI%/setenv

@set APPNAME=hdcalcul
@set PACKAGE=su.harbour.hdcalcul
@set PACKAGE_PATH=su\harbour\hdcalcul
@set MAIN_CLASS=MainActivity
@set DEV_HOME=%CD%

11) build the .apk running: c:\Android\projects\hdcalcul\build.bat. The .apk will be generated at c:\Android\projects\hdcalcul\bin.

@call setenv
@call clear

@%HRB_BIN%\harbour src\main.prg /q /i%HDROIDGUI%\src\include /i%HRB_INC% /ojni\

@if errorlevel 1 goto end

@set NDK_LIBS_OUT=lib

@set SRC_FILES=main.c
%NDK_HOME%\prebuilt\windows\bin\make.exe -f %NDK_HOME%/build/core/build-local.mk %* >a1.out 2>a2.out

@if exist lib\armeabi\libh4droid.so goto comp
@echo Errors while compiling C sources
@goto end

call %BUILD_TOOLS%/aapt.exe package -f -m -S res -J src -M AndroidManifest.xml -I %ANDROID_JAR%

@if errorlevel 1 goto end

@rem compile, convert class dex

@rem call %JAVA_HOME%/bin/javac -d obj -cp %ANDROID_JAR%;%HDROIDGUI%\hdroidgui.jar -sourcepath src src/%PACKAGE_PATH%/*.java
call "%JAVA_HOME%/bin/javac" -d obj -cp %ANDROID_JAR%;%HDROIDGUI%\libs -sourcepath src src/%PACKAGE_PATH%/*.java

@if errorlevel 1 goto end

call %BUILD_TOOLS%/dx.bat --dex --output=bin/classes.dex obj %HDROIDGUI%\libs

@if errorlevel 1 goto end

@rem create APK
call %BUILD_TOOLS%/aapt.exe package -f -M AndroidManifest.xml -S res -I %ANDROID_JAR% -F bin/%APPNAME%.unsigned.apk bin

call %BUILD_TOOLS%/aapt.exe add %DEV_HOME%/bin/%APPNAME%.unsigned.apk lib/armeabi/libharbour.so

@if errorlevel 1 goto end

call %BUILD_TOOLS%/aapt.exe add %DEV_HOME%/bin/%APPNAME%.unsigned.apk lib/armeabi/libh4droid.so

@rem sign APK
call "%JAVA_HOME%/bin/keytool" -genkey -v -keystore myrelease.keystore -alias key2 -keyalg RSA -keysize 2048 -validity 10000 -storepass calcpass -keypass calcpass -dname "CN=Alex K, O=Harbour, C=RU"

call "%JAVA_HOME%/bin/jarsigner" -sigalg SHA1withRSA -digestalg SHA1 -keystore myrelease.keystore -storepass calcpass -keypass calcpass -signedjar bin/%APPNAME%.signed.apk bin/%APPNAME%.unsigned.apk key2
%BUILD_TOOLS%/zipalign -v 4 bin/%APPNAME%.signed.apk bin/%APPNAME%.apk


12) To test it, you only must to copy the .apk generated file to an Android device
and run it.

13) In my case I have synchronized the smarphone and notebook with the cloud, so I copy the .apk file from the notebook folder and automatically updated on the smartphone, same with screenshots of the smartphone are immediately in the notebook 🙂