HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Issues and Discussions related to Harbour

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Post by Roberto Lopez »

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

http://www.oracle.com/technetwork/es/ja ... 80260.html

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.

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:

Code: Select all

@set path=c:\harbour\bin;%PATH%;
@set HRB_BIN=c:\harbour\bin
@set HRB_INC=c:\harbour\include
@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:\PROGRA~1\java\jdk1.7.0_75
@set ADB=%ANDROID_HOME%\platform-tools\adb.exe
@set ANDROID_JAR=%ANDROID_HOME%\platforms\android-21\android.jar
Tips:
- 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:\harbour. If that is not your path, please change it as needed. If you do not have Harbour installed, please download from: http://sourceforge.net/projects/harbour ... urce=files and unzip at c:\harbour

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:\hdcalcul

11. build the .apk running: c:\hdcalcul\build.bat. The .apk will be generated at c:\hdcalcul\bin. To avoid errors about keystore, please, delete the file 'myrelease.keystore'.

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

You can do that in many different ways. In my case, I do file transfers via FTP and
launch apks from a file management app.

Don't forget to change your device configuration to allow application installation
from sources different than Play Store.


Enjoy!

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HDROIDGUI SETUP TUTORIAL (re-edited and translated)

Post by Pablo César »

Hi Roberto,

Thank you for your contribution in this tutorial.

What I have noted the script of C:\Android\projects\HDroidGUI\setenv.bat you have indicated as:

@set JAVA_HOME=C:\ARCHIV~1\java\jdk1.7.0_75

And in your previous item you indicate to be installed at C:\Program Files\java\jdk1.7.0_75.

Even considering jdk could be differed by its version, in that script shall it be not found because setenv.bat is lie as ARCHIV~1. IMHO should it be PROGRA~1 (Program Files) instead that.
I do not know if this is a No sé por que indicaste diferente, no sé si es una peculiarity from local version of Windows but for me is working like as PROGRA~1.

Shall it be re-edited or is this correct ?

When C:\Android\projects\HDroidGUI\buildall.bat execution is displaying an error due missing lib\armeabi\libh4droid.so file :(
Screen5.png
Screen5.png (22.93 KiB) Viewed 10823 times
Could you tell me if C:\hdcalcul\build.bat and C:\Android\projects\HDroidGUI\buildall.bat files must be corrected with lib\libh4droida.a in place of lib\armeabi\libh4droid.so ?

Rgds
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HDROIDGUI SETUP TUTORIAL

Post by Pablo César »

HDROIDGUI SETUP TUTORIAL (UPDATED)

I've note Roberto changed your instruction. Thank you for your providences. :)

Some changing I made by my account due non response about:
Could you tell me if C:\hdcalcul\build.bat and C:\Android\projects\HDroidGUI\buildall.bat files must be corrected with lib\libh4droida.a in place of lib\armeabi\libh4droid.so ?
Roberto Lopez wrote: then build the .apk running: c:\hdcalcul\build.bat. The .apk will be generated at c:\hdcalcul\bin
Some error occured when tried to execute this:
C:\hdcalcul>call c:\Android\sdk\build-tools\21.1.2\dx.bat --dex --output=bin/classes.dex obj \android\projects\hdroidgui\libs
 '\android\projects\hdroidgui\obj\local\armeabi\libharbour.so'...
 '\android\projects\hdroidgui\lib\libh4droida.a'...
keytool error: java.lang.Exception: Key pair not genearted; alias <key2> already exists
java.lang.Exception: Key pair not genearted; alias <key2> already exists
        at sun.security.tools.KeyTool.doGenKeyPair(KeyTool.java:1529)
        at sun.security.tools.KeyTool.doCommands(KeyTool.java:969)
        at sun.security.tools.KeyTool.run(KeyTool.java:340)
        at sun.security.tools.KeyTool.main(KeyTool.java:333)
*Red color was translated from portuguese. Orginal text: Par de chaves não gerado; o alias <key2> já existe

And at final one warning message:
Warning:
No -tsa or -tsacert is provided and this jar is not timestamped. Without a times
tamp, users may not be able to validate this jar after the signer certificate's
expiration date (2042-07-13) or after any future revocation date.
Verifying alignment of bin/hdcalcul.apk (4)...
      50 META-INF/MANIFEST.MF (OK - compressed)
    388 META-INF/KEY2.SF (OK - compressed)
    793 META-INF/KEY2.RSA (OK - compressed)
   1911 AndroidManifest.xml (OK - compressed)
   2777 classes.dex (OK - compressed)
   8870 \android\projects\hdroidgui\obj\local\armeabi\libharbour.so (OK - compressed)
  986691 \android\projects\hdroidgui\lib\libh4droida.a (OK - compressed)
Verification succesful
Files were created at C:\hdcalcul\bin:
hdcalcul.apk
hdcalcul.signed.apk
hdcalcul.unsigned.apk
classes.dex

Somebody got successful to run this hdcalcul project ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: HDROIDGUI SETUP TUTORIAL (UPDATED)

Post by dragancesu »

I managed to create and run .apk
build.png
build.png (23.02 KiB) Viewed 10614 times
The second time I started build.bat I received such a message

I delete myrelease.keystore and did not report an error next time

there is probably preserved certificate
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HDROIDGUI SETUP TUTORIAL (re-edited and translated)

Post by mol »

Pablo César wrote:Hi Roberto,

Thank you for your contribution in this tutorial.

What I have noted the script of C:\Android\projects\HDroidGUI\setenv.bat you have indicated as:

@set JAVA_HOME=C:\ARCHIV~1\java\jdk1.7.0_75

And in your previous item you indicate to be installed at C:\Program Files\java\jdk1.7.0_75.

Even considering jdk could be differed by its version, in that script shall it be not found because setenv.bat is lie as ARCHIV~1. IMHO should it be PROGRA~1 (Program Files) instead that.
I do not know if this is a No sé por que indicaste diferente, no sé si es una peculiarity from local version of Windows but for me is working like as PROGRA~1.

Shall it be re-edited or is this correct ?

When C:\Android\projects\HDroidGUI\buildall.bat execution is displaying an error due missing lib\armeabi\libh4droid.so file :(
Screen5.png
Could you tell me if C:\hdcalcul\build.bat and C:\Android\projects\HDroidGUI\buildall.bat files must be corrected with lib\libh4droida.a in place of lib\armeabi\libh4droid.so ?

Rgds
I've stopped in this point with:
Errors while compiling C sources

How to do next step?
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Post by Pablo César »

I was also unsuccessfull with this, Marek... :(
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Post by mol »

I found such an error describe:

Code: Select all

obj/local/armeabi/objs/h4droid/hdmain.o:hdmain.c:symbols_table: error: undefined reference to 'HB_FUN___BREAKBLOCK'
collect2.exe: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libh4droid.so] Error 1
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Post by mol »

I've addec some code:

Code: Select all

FUNCTION __BreakBlock()

   RETURN {| e | Break( e ) }

to HDroidGUI\src\prg\hdmain.prg
and I passed to next errors:

Code: Select all

src\su\harbour\hDroidGUI\Harbour.java:202: error: cannot find symbol
    private View CreateView( String sContent ) {
            ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:343: error: cannot find symbol
    private static void SetSize( View mView, String [][] aParams ) {
                                 ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:560: error: package DialogInterface does n
ot exist
    private static class BtnClickListener implements DialogInterface.OnClickList
ener {
                                                                    ^
src\su\harbour\hDroidGUI\Harbour.java:569: error: cannot find symbol
        public void onClick(DialogInterface dialog, int id) {
                            ^
  symbol:   class DialogInterface
  location: class BtnClickListener
src\su\harbour\hDroidGUI\Harbour.java:71: error: cannot find symbol
       mainView = CreateActivity( (Activity)context, sMain);
                                   ^
  symbol:   class Activity
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:76: error: cannot find symbol
          LinearLayout ll = new LinearLayout(context);
          ^
  symbol:   class LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:76: error: cannot find symbol
          LinearLayout ll = new LinearLayout(context);
                                ^
  symbol:   class LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:77: error: cannot find symbol
          ll.setOrientation(LinearLayout.VERTICAL);
                            ^
  symbol:   variable LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:79: error: cannot find symbol
          TextView textview = new TextView(context);
          ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:79: error: cannot find symbol
          TextView textview = new TextView(context);
                                  ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:92: error: cannot find symbol
       View rootView;
       ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:122: error: cannot find symbol
       LinearLayout ll = new LinearLayout(context);
       ^
  symbol:   class LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:122: error: cannot find symbol
       LinearLayout ll = new LinearLayout(context);
                             ^
  symbol:   class LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:133: error: cannot find symbol
                   ll.setOrientation(LinearLayout.VERTICAL);
                                     ^
  symbol:   variable LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:135: error: cannot find symbol
                   ll.setOrientation(LinearLayout.HORIZONTAL);
                                     ^
  symbol:   variable LinearLayout
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:141: error: cannot find symbol
          SetSize( (View)ll, aParams );
                    ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:154: error: cannot find symbol
       View mView;
       ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:206: error: cannot find symbol
       View mView;
       ^
  symbol:   class View
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:233: error: cannot find symbol
          TextView mtextview = new TextView(context);
          ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:233: error: cannot find symbol
          TextView mtextview = new TextView(context);
                                   ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:251: error: cannot find symbol
          Button mButton = new Button(context);
          ^
  symbol:   class Button
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:251: error: cannot find symbol
          Button mButton = new Button(context);
                               ^
  symbol:   class Button
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:262: error: package View does not exist
                   mButton.setOnClickListener(new View.OnClickListener() {
                                                      ^
src\su\harbour\hDroidGUI\Harbour.java:274: error: cannot find symbol
          EditText medit = new EditText(context);
          ^
  symbol:   class EditText
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:274: error: cannot find symbol
          EditText medit = new EditText(context);
                               ^
  symbol:   class EditText
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:287: error: package View does not exist
                   medit.setOnKeyListener(new View.OnKeyListener() {
                                                  ^
src\su\harbour\hDroidGUI\Harbour.java:304: error: cannot find symbol
          CheckBox mche = new CheckBox(context);
          ^
  symbol:   class CheckBox
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:304: error: cannot find symbol
          CheckBox mche = new CheckBox(context);
                              ^
  symbol:   class CheckBox
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:326: error: cannot find symbol
          ScrollView sv = new ScrollView(context);
          ^
  symbol:   class ScrollView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:326: error: cannot find symbol
          ScrollView sv = new ScrollView(context);
                              ^
  symbol:   class ScrollView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:329: error: package LinearLayout does not
exist
          LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(
                      ^
src\su\harbour\hDroidGUI\Harbour.java:329: error: package LinearLayout does not
exist
          LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(
                                                            ^
src\su\harbour\hDroidGUI\Harbour.java:330: error: package LinearLayout does not
exist
                LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams
.MATCH_PARENT);
                            ^
src\su\harbour\hDroidGUI\Harbour.java:330: error: package LinearLayout does not
exist
                LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams
.MATCH_PARENT);
                                                                   ^
src\su\harbour\hDroidGUI\Harbour.java:357: error: package LinearLayout does not
exist
          LinearLayout.LayoutParams parms;
                      ^
src\su\harbour\hDroidGUI\Harbour.java:359: error: package LinearLayout does not
exist
             iHeight = LinearLayout.LayoutParams.MATCH_PARENT;
                                   ^
src\su\harbour\hDroidGUI\Harbour.java:361: error: package LinearLayout does not
exist
             iWidth = LinearLayout.LayoutParams.MATCH_PARENT;
                                  ^
src\su\harbour\hDroidGUI\Harbour.java:363: error: package LinearLayout does not
exist
             parms = new LinearLayout.LayoutParams(iWidth,iHeight,1);
                                     ^
src\su\harbour\hDroidGUI\Harbour.java:365: error: package LinearLayout does not
exist
             parms = new LinearLayout.LayoutParams(iWidth,iHeight);
                                     ^
src\su\harbour\hDroidGUI\Harbour.java:376: error: cannot find symbol
          iColor = Color.parseColor( sColor );
                   ^
  symbol:   variable Color
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:453: error: cannot find symbol
       Log.i(TAG, message);
       ^
  symbol:   variable Log
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:460: error: cannot find symbol
       TextView tview = null;
       ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:475: error: cannot find symbol
             tview = (TextView) mainView.findViewWithTag( stag );
                      ^
  symbol:   class TextView
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:501: error: package AlertDialog does not e
xist
       AlertDialog.Builder builder = new AlertDialog.Builder(context);
                  ^
src\su\harbour\hDroidGUI\Harbour.java:501: error: package AlertDialog does not e
xist
       AlertDialog.Builder builder = new AlertDialog.Builder(context);
                                                    ^
src\su\harbour\hDroidGUI\Harbour.java:555: error: cannot find symbol
        AlertDialog alert = builder.create();
        ^
  symbol:   class AlertDialog
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:568: error: method does not override or im
plement a method from a supertype
        @Override
        ^
src\su\harbour\hDroidGUI\Harbour.java:578: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_DOCUMENTS) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:578: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_DOCUMENTS) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:580: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_PICTURES) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:580: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_PICTURES) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:582: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_MUSIC) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:582: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_MUSIC) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:584: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_MOVIES) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:584: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_MOVIES) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:586: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_DOWNLOADS) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:586: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_DOWNLOADS) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:588: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_RINGTONES ) + "/";
                                                               ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:588: error: cannot find symbol
          return Environment.getExternalStoragePublicDirectory(Environment.DIREC
TORY_RINGTONES ) + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
src\su\harbour\hDroidGUI\Harbour.java:590: error: cannot find symbol
          return Environment.getExternalStorageDirectory() + "/";
                 ^
  symbol:   variable Environment
  location: class Harbour
84 errors
It's caused by missing some files, I think.
jparada
Posts: 430
Joined: Fri Jan 23, 2009 5:18 pm

Re: HDROIDGUI SETUP TUTORIAL (UPDATED 2015.02.27)

Post by jparada »

Hi Roberto,

To create a new project I just copy the entire contents of hdcalcul and edit all files that reference hdcalcul and does not work. how can I create a new project?.

I read a little about newproject.prg file in the util folder, but for now I do not know how to use it.

I appreciate any help.

Thanks.

Regards,
Javier
Post Reply