============================
android-programming-on-linux
============================

.. raw:: html

   <table class="provenance-header" style="border: 0; border-collapse: collapse; margin: 0 0 16px 0; width: 100%;">

.. raw:: html

   <tr style="border: 0;">

.. raw:: html

   <td style="border: 0; vertical-align: top; padding: 0 24px 0 0;">

..

   | **Source:**
     https://foxhop.net/f3a3100e-2f95-11f1-a963-e86a64d24d78/android-programming-on-linux
   | **Snapshot:** 2026-10-16T05:34:55Z
   | **Generator:** Remarkbox ``d747782``

   *This is a thread snapshot. The living document lives at the source
   URI above — it may have been edited, extended, or replied-to since.*

.. raw:: html

   </td>

.. raw:: html

   <td style="border: 0; vertical-align: top; width: 200px; text-align: right;">

.. figure:: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAACkAQAAAAAxzrjsAAABZ0lEQVR42tWXO47DQAxDib2A7n9L3UDRo7zAFmkCsMhOkPhT0DKHohjNm9X64ruSak9mT7qnuOwfvVuf3NUsaI0Wt8RjuMzgqsqlHjiXQdxF3vfvmihubalb8hIdrJeXX07FIcgvAvizYnpgwcMWS91WX4ZfaO2xeBd8vykeFnTFKyi2hmP89oNJ7eoQv24JiBBVb0eHcNmuxRYCW+hSTGe4D+U2T+CTwG0roJEDBxSSwWW/QPWOwXRq39xjp2LcJ+W/fV2GWWLFKX7pMqqEEf+m/MF6aNioZ3BkdLYm5nqRxUDvxPht+06fjlN+1nZgrAwtK+UPsh5OcOUuDvqDPOIsuUr5JHB9fmOWU/wasPp0zBRK9Zt+XYetUwfzzpRHhWVcyXncDhA4MP4em28mGR7GGSKXd5hvF1AgOJfP5kxSh53DtZ3pdNzBnHrj4sJOMK87l6AEfDKYJ5kVtEZfSIvp9//8z3oB3pjChCNLkPYAAAAASUVORK5CYII=
   :alt: Scan for living source

   Scan for living source

.. raw:: html

   </td>

.. raw:: html

   </tr>

.. raw:: html

   </table>

Android programming on Linux
============================

.. container::

Setup your development environment
----------------------------------

-  install the Java Development Kit (JDK)

   .. container::
      :name: cb1

      ::

         # On Redhat or Fedora run the following

         yum install java-1.7.0-openjdk
         yum install java-1.7.0-openjdk-devel

-  install the android sdk:

   ::

      http://developer.android.com/sdk/index.html

-  adjust your path environment variable

   .. container::
      :name: cb3

      ::

         # echo 'export PATH=$PATH:/home/fox/android/tools:/home/fox/android/platform-tools' >> ~/.bashrc
         echo 'export PATH=$PATH:/path/to/android/tools' >> ~/.bashrc

-  optionally install eclipse

-  create an ADV (android virtual device) emulator

**Tip:** Add the platform-tools/ as well as the tools/ directory to your
PATH environment variable.

Create an android project on the cli
------------------------------------

reference:
http://developer.android.com/guide/developing/projects/projects-cmdline.html

The following cli command will create an android project skeleton named
HelloWorld in your home directory.

.. container::
   :name: cb4

   ::

      android create project \
         --package com.example.helloworld \
         --activity HelloWorld \
         --target 3 \
         --path ~/HelloWorld

target
   The "build target" for your application.

   This corresponds to an Android platform library (including any
   add-ons, such as Google APIs) that you would like to build your
   project against.

   To see a list of available targets and their corresponding IDs,
   **execute: android list targets.**

name
   The name for your project.

   This is optional. If provided, this name will be used for your .apk
   filename when you build your application.

path
   The location of your project directory.

   If the directory does not exist, it will be created for you.

activity
   The name for your default Activity class.

   This class file will be created for you inside
   <path_to_your_project>/src/<your_package_namespace_path>/ .

   This will also be used for your .apk filename unless you provide a
   name.

package
   the package namespace for your project

   This will follow the Java programming language standards.

Programming the HelloWorld project
----------------------------------

modify your source code...

Building and running from the command line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reference:
http://developer.android.com/guide/developing/building/building-cmdline.html

The Ant script compiles and builds your project into a .apk file which
may be installed on an emulator or device.

Ant provides the following two build modes:

-  Test or Debug (Development)
-  Release (Production)

Regardless of the build mode chosen the application must be signed
before it can be installed on an emulator or device.

In development (debug mode) the SDK will automatically sign your project
with a development key. An application signed with a development key
cannot be distributed.

In production (release mode) the SDK will not sign the .apk file, you
will need to do this manually using the Keytool and Jarsigner.

Building in debug mode (development)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Navigate to root of the project

2. Compile the project using Ant.

   .. container::
      :name: cb5

      ::

         ant debug

Install debug application to emulator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Start your AVD (android Virtual Device) emulator.
2. Install your application using the adb script which exists in the
   platform-tools/ directory of the SDK.

..

   .. container::
      :name: cb6

      ::

         adb install ~/HelloWorld/bin/HelloWorld-debug.apk

   You might need to specify the device serial which is found on the top
   of the virtual device titlebar.

   .. container::
      :name: cb7

      ::

         adb -s emulator-5554 install ~/HelloWorld/bin/HelloWorld-debug.apk

   A top secret command for both building in debug mode and deploying to
   a running emulator use the following command:

   .. container::
      :name: cb8

      ::

         ant install 

How to update Android SDK
-------------------------

Periodically you may want to update your development environment, here's
how:

-  open a Terminal (ctrl+alt+t)
-  type 'android' and press enter
-  click the 'Installed packages' tab
-  click the 'Update All...' button

Installing Scala
----------------

Not directly related to Android development, but I plan to learn Scala
(expand my use of functional langs) while building android apps. Replace
version with latest in the subsequent code block.

.. container::
   :name: cb9

   ::

      # download & unzip
      wget hhttp://www.scala-lang.org/files/archive/scala-2.11.0.tgz
      tar -xzvf scala-2.11.0.tgz

      # install
      sudo mv scala-2.11.0 /usr/share/scala
      sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
      sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
      sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
      sudo ln -s /usr/share/scala/bin/scaladoc /usr/bin/scaladoc
      sudo ln -s /usr/share/scala/bin/scalap /usr/bin/scalap

might need sbt (scala build tools)

scala game engines
------------------

https://github.com/dunnololda/scage :
   game engine

http://scalandroid.blogspot.com/ :
   game making blog scala android scawars devs used: maven progaurd
   scala

http://www.drdobbs.com/mobile/developing-android-apps-with-scala-and-s/ :
   android app development with scala

http://scala-ide.org/docs/tutorials/androiddevelopment/index.html :
   andoir app development with scala

https://github.com/banshee/AndroidProguardScala
   compiles only the parts of scala lib that your application needs.

http://eed3si9n.com/tetrix-in-scala/index.html :
   tetris in scala step by step howto really in depth !

   http://eed3si9n.com/tetrix-in-scala/android.html
      port a scala tetris game to android using 'android', sbt,
      pfn/android-plugin,

libGDX
------

libGDX is a cross-platform Java game development framework based on
OpenGL (ES) that works on Windows, Linux, Mac OS X, Android, your WebGL
enabled browser and iOS.

https://github.com/libgdx/libgdx

https://github.com/libgdx/libgdx/wiki/

https://github.com/libgdx/libgdx/wiki/Using-libgdx-with-Scala
   describes how to use sbt (scala build tool and g8 to build android
   apps)

http://www.badlogicgames.com/ :
   Mario's game dev blog which is very active, he authored libGDX and
   builds lots of android games.

unofficial libGDX references

http://raintomorrow.cc/post/70000607238/develop-games-in-scala-with-libgdx-getting-started :
   develop games in scala with libgdx getting-started

https://www.youtube.com/watch?v=P-XN5gPRZkw
   libGDX games on android youtube video

--------------

| **Source:**
  https://foxhop.net/f3a3100e-2f95-11f1-a963-e86a64d24d78/android-programming-on-linux
| **Snapshot:** 2026-10-16T05:34:55Z
| **Generator:** Remarkbox ``d747782``
