android-programming-on-linux
Android programming on Linux
Setup your development environment
install the Java Development Kit (JDK)
install the android sdk:
http://developer.android.com/sdk/index.htmladjust your path environment variable
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.
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)
Navigate to root of the project
Compile the project using Ant.
Install debug application to emulator
- Start your AVD (android Virtual Device) emulator.
- Install your application using the adb script which exists in the platform-tools/ directory of the SDK.
You might need to specify the device serial which is found on the top of the virtual device titlebar.
A top secret command for both building in debug mode and deploying to a running emulator use the following command:
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.
# 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/scalapmight 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
Remarkbox
Comments