Android programming on Linux
install the Java Development Kit (JDK)
# 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:
adjust your path environment variable
# 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.
The following cli command will create an android project skeleton named HelloWorld in your home directory.
android create project \ --package com.example.helloworld \ --activity HelloWorld \ --target 3 \ --path ~/HelloWorld
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.
The name for your project.
This is optional. If provided, this name will be used for your .apk filename when you build your application.
The location of your project directory.
If the directory does not exist, it will be created for you.
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.
the package namespace for your project
This will follow the Java programming language standards.
modify your source code...
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.
Navigate to root of the project
Compile the project using Ant.
- Start your AVD (android Virtual Device) emulator.
- Install your application using the adb script which exists in the platform-tools/ directory of the SDK.
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.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:ant install
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
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.
# 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)
- 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
- 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 !
- port a scala tetris game to android using 'android', sbt, pfn/android-plugin,
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.
- 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
- libGDX games on android youtube video