<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>I'm still struggling to compile BRLTTY for Android on Windows. I
      tried few different ways how to do that, but all failed. I will
      describe my attempts here. Note I followed the help in
      Documents/README.Android file.</p>
    <p>1) Using Cygwin or MinGW - this path was a dead end. I was able
      to install the required tools like autogen, make, etc. but I got
      stuck at weird errors I don't even remember now. I don't think
      this is good way anyway.<br>
    </p>
    <p>2) On Windows 10 there is now Linux Subsystem feature which we
      can use directly instead of Cygwin / MinGW. I enabled it,
      installed Ubuntu, and tried compilation of BRLTTY there. It went
      much more easily, but I got stuck at the final "make -s" in
      Android/Application folder anyway.</p>
    <p>Also it is worth mentioning there are various difficulties
      regarding this way:<br>
      - It is available only on Windows 10 and it requires some work to
      enable it and install it.<br>
      - When getting sources via Git checkout, repository must be
      configured with <i>autocrlf = false</i>, so files will have LF
      (not CRLF as default on Windows) line endings. Otherwise <i>autogen</i>
      and other tools fails to work.<br>
      - We must download both Android SDK and Android NDK for linux and
      have it separate from our normal Android SDK/NDK for Windows which
      we are using for example in Android Studio.<br>
      - Just note that we must also use <i>"/mnt/c/</i>some-directory"
      paths instead of "C:\some-directory" paths everywhere.</p>
    <p>So <i>./autogen</i> and <i>./cfg-andorid -q</i> commands
      finished successfully, but there were configure warning which I
      don't know if are ok to ignore. See below:</p>
    <p><i>configure: WARNING: no commonly used jni installation
        directory</i><i><br>
      </i><i>configure: WARNING: Cannot find ocamlc.</i><i><br>
      </i><i>configure: WARNING: OCaml BrlAPI bindings not included</i><i><br>
      </i><i>configure: WARNING: Tcl configuration script not found:
        tclConfig.sh</i><i><br>
      </i><i>configure: WARNING: Tcl packages directory not found</i><i><br>
      </i><i>configure: WARNING: Tcl BrlAPI bindings not included</i><i><br>
      </i><i>configure: WARNING: dbus support not available</i><i><br>
      </i><i>configure: WARNING: polkit support not available</i><i><br>
      </i><i>configure: WARNING: louis support not available</i><i><br>
      </i><i>configure: WARNING: dbus support not available</i></p>
    <p>Then when I tried <i>make -s</i> in Android/Application
      directory and it failed with:</p>
    <p><i>make: android: Command not found</i><i><br>
      </i><i>../../Android/common.mk:16: recipe for target
        'local.properties' failed</i><i><br>
      </i><i>make: *** [local.properties] Error 127</i></p>
    <p>So I created empty <i>local.properties</i> file, and run command
      again. It started compiling and showed some warnings in C code and
      then whole build failed at this error:</p>
    <p><i>brltty/Android/Core/build.xml:55: sdk.dir is missing. Make
        sure to generate local.properties using 'android update project'
        or to inject it through the ANDROID_HOME environment variable.</i></p>
    <p>So I tried to run <i>android update project</i> and it failed
      with:</p>
    <p><i>The "android" command is deprecated.</i><i><br>
      </i><i>For manual SDK, AVD, and project management, please use
        Android Studio.</i><i><br>
      </i><i>For command-line tools, use tools\bin\sdkmanager.bat</i><i>
      </i><i>and tools\bin\avdmanager.bat<br>
        Invalid or unsupported command "update project"</i></p>
    <p>I find out that all that command does is it creates <i>local.properties</i>
      file with <i>sdk.dir</i> property set to path to SDK directory.
      So for example <i>sdk.dir=/mnt/c/Android/SDK<br>
      </i>So I created this file in both Android/Application and
      Android/Core directories.<br>
      <i></i></p>
    <p>Then I run <i>make -s</i> again and it failed with<br>
      <i></i></p>
    <p><i>brltty/Android/Core/build.xml:90: Cannot find
        Android/SDK/tools/ant/build.xml imported from
        brltty/Android/Core/build.xml</i></p>
    <p>I find this question:
<a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it">https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it</a>
      where they say ant scripts were removed from SDK tools 25.3.0
      (about year ago).<br>
      That means you are using some old SDK if building with your
      scripts still works ok for you. Note before I had also some
      similar problem with NDK, but since you started using latest
      version of NDK already, there was no problem at this time.<br>
    </p>
    <p>So I downloaded older SDK tools (version 25.2.5 as mentioned in
      the link above), then I had to install rest of Android SDK things
      like build tools 21.1.2 and android-16 and android-21 platforms.</p>
    <p>Then I run <i>make -s</i> again and it failed with this error:</p>
    <p><i>(...)<br>
        -code-gen:<br>
        [mergemanifest] No changes in the AndroidManifest files.<br>
             [echo] Handling aidl files...<br>
             [aidl] No AIDL files to compile.<br>
             [echo] ----------<br>
             [echo] Handling RenderScript files...<br>
             [echo] ----------<br>
             [echo] Handling Resources...<br>
             [aapt] Generating resource IDs...<br>
             [aapt] /mnt/d/Android/SDK-linux/build-tools/21.1.2/aapt: 1:
        /mnt/d/Android/SDK-linux/build-tools/21.1.2/aapt: Syntax error:
        "(" unexpected (expecting ")")<br>
        BUILD FAILED<br>
        /mnt/d/Android/SDK-linux/tools/ant/build.xml:649: The following
        error occurred while executing this line:<br>
        /mnt/d/Android/SDK-linux/tools/ant/build.xml:694: null returned:
        2<br>
      </i></p>
    <p>I don't understand what is wrong now or how to continue.</p>
    <p>3) Having standard Android Studio project with Gradle build
      system + CMake for native libraries would be perfect (and
      multiplatform) way to build BRLTTY for Android.</p>
    <p>I am able to import BRLTTY Android/Application and Android/Core
      sources into new Android studio project and compile the Java code
      easily (after fixing some warnings/errors in some files). Then if
      I take compiled <i>brltty_core.so</i> and <i>brltty_jni.so</i>
      and other assets from your APK and include it into my APK, the
      final application works correctly. But problem is with compiling
      the native code. Android Studio uses CMake for building native
      code (also they still support <i>ndk-build</i>, but it's only for
      compatibility with old projects and they recommend to use CMake).
      I was able to prepare CMake script for compiling <i>brltty_jni.so</i>
      and it worked correctly as it's source is only pretty simple <i>brltty_jni.c</i>
      file. But I wasn't able to compile the <i>brltty_core.so</i> file
      for 2 reasons. Firstly I don't know what source files are compiled
      into <i>brltty_core.so</i>, as I'm not familiar with the Make and
      Ant scripts you use here. Secondly I tried to include at least
      some files like <i>brltty.c, core.c</i> and some others I found
      in one makefile, but during compiling it showed various warnings
      and errors, which felt like I'm using incompatible compiler or
      something.</p>
    <p><br>
    </p>
    <p>Can you help me with these issues somehow? Have you thought about
      using CMake for building whole BRLTTY project?</p>
    <p>Thanks,<br>
      Robert Pösel<br>
    </p>
  </body>
</html>