Tuesday, December 31, 2013
Wednesday, November 6, 2013
Fragment subclasses
Here are some memos for Fragment
subclasses
From Android
DialogFragment
ListFragmnet
android.app.DialogFragment
android.app.ListFragment
From gms
MapFragment
com.google.android.gms.maps.MapFragment
That's it. Make your own fragment for your convenience.
Wednesday, May 8, 2013
PhoneInfo
Friday, May 3, 2013
Patterns
Active record pattern
In software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture. The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table. For example,
part = new Part()
part.name = "Sample part"
part.price = 123.45
part.save()
is equivalent to SQL command
INSERT INTO parts (name, price) VALUES ('Sample part', 123.45);
JAVA
code:
b = part.find_first("name", "gearbox")
is equivalent to SQL command
SELECT * FROM parts WHERE name = 'gearbox' LIMIT 1;
Convention over configuration
Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility.
Don't repeat yourself
In software engineering, don't repeat yourself (DRY) is a principle of software development aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures. The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system."
Abstraction principle
software engineering and programming language theory, the abstraction principle (or the principle of abstraction) is a basic dictum that aims to reduce duplication of information in a program (usually with emphasis on code duplication) whenever practical by making use of abstractions provided by the programming language or software libraries. The principle is sometimes stated as a recommendation to the programmer, but sometimes stated as requirement of the programming language, assuming it is self-understood why abstractions are desirable to use. As a recommendation to the programmer, in its formulation by Benjamin C. Pierce in Types and Programming Languages (2002), the abstraction principle reads (emphasis in original):
“Each significant piece of functionality in a program should be implemented in just one place in the source code. Where similar functions are carried out by distinct pieces of code, it is generally beneficial to combine them into one by abstracting out the varying parts."
Model–view–controller a.k.a. MVC
Model–view–controller (MVC) is a software architecture pattern which separates the representation of information from the user's interaction with it. The model consists of application data, business rules, logic, and functions. A view can be any output representation of data, such as a chart or a diagram. Multiple views of the same data are possible, such as a bar chart for management and a tabular view for accountants. The controller mediates input, converting it to commands for the model or view. The central ideas behind MVC are code reusability and separation of concerns.
Singleton pattern
In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects. The term comes from the mathematical concept of a singleton.
- Eager initialization
public class Singleton {
private static final Singleton instance = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return instance;
}
}
public class Singleton {
private static final Singleton instance;
static {
try {
instance = new Singleton();
} catch (IOException e) {
throw new RuntimeException("Darn, an error occurred!", e);
}
}
public static Singleton getInstance() {
return instance;
}
private Singleton() {
// ...
}
}
public class Singleton {
// Private constructor prevents instantiation from other classes
private Singleton() { }
/**
* SingletonHolder is loaded on the first execution of Singleton.getInstance()
* or the first access to SingletonHolder.INSTANCE, not before.
*/
private static class SingletonHolder {
public static final Singleton INSTANCE = new Singleton();
}
public static Singleton getInstance() {
return SingletonHolder.INSTANCE;
}
}
public enum Singleton {
INSTANCE;
public void execute (String arg) {
//... perform operation here ...
}
}
Wednesday, April 17, 2013
GDK?
gdk
inside ./android
since JB (API 16). Based on the fact that gdk
is result of efforts to adopt llvm
into Android, I'm not sure where to begin with. I'll start with Dalvik, DVM, NDK
, and LLVM
before jumping into the conclusion. Even though it's not populated until API 17, but the bottom line is supporting gdk
can be a good sign that Android is now ready to adopt other than DVM
. along with NDK
.
Dalvik
and DVM
Dalvik is just another yet virtual machine which is suitable for mobile computing environment (which requires lesser memory and cpu than usual). Android uses the Dalvik virtual machine with just-in-time compilation to run Dalvik
dex
(Dalvik Executable). This converting job is done with the tool called dx
as follows:
- Converts
class
file intodex
(Dalvik Executable) format. - Includes every constants into the above
dex
file. - Converts java bytecodes into DVM instruction sets
- Optimization (however, there are a lot of context of 'optimization' e.g.
odex
,dexopt
Compilation of
dex
is usually done in below ways:
- The VM does it "just in time". The output goes into a special
dalvik-cache
directory. This works on the desktop and engineering-only device builds where the permissions on thedalvik-cache
directory are not restricted. On production devices, this is not allowed. - The system installer does it when an application is first added. It has the privileges required to write to
dalvik-cache
. - The build system does it ahead of time. The relevant
jar
orapk
files are present, but theclasses.dex
is stripped out. Theodex
is stored next to the originalzip
archive, not indalvik-cache
, and is part of the system image.
Last not but least, there are derivation of
DVM
, which is called DTVM
(Dalvik turbo virtual machine),and as of JB API 16, it is backward compatible with MIPS architecture. More on DTVM on MIPS.
NDK
However, DVM itself is sometimes not sufficient enough to do native-oriented application; e.g. Graphics, 3D rendering, etc. NDK
is a tool that allows Android apps can run native-code. (e.g. C, C++) Main design for NDK
is to tackle either computationally expensive operation (while not memory consuming), or kind of system attached operation (for example operation which requires a lot of context switching). Here is summary from NDK
overview (./android/ndk/docs/OVERVIEW.html)
:
- The Android VM allows your application's source code to call methods implemented in native code through the JNI.
- The Android
NDK
is a complement to the Android SDK. - The Android
NDK
provides a set of cross-toolchains (compilers, linkers, etc..) that can generate native ARM binaries on Linux, OS X and Windows (with Cygwin) - The Android
NDK
provides a set of system headers corresponding to the list of stable native APIs supported by the Android platform. This corresponds to definitions that are guaranteed to be supported in all later releases of the platform. - The Android
NDK
provides - The Android
NDK
is NOT a good way to write generic native code that runs on Android devices. In particular, your applications should still be written in the Java programming language, handle Android system events appropriately to avoid the "Application Not Responding" dialog or deal with the Android application lifecycle.
NDK
is an efforts of making Android more flexible by supporting certain level of native codes. And sometimes, yes sometimes, it can be much faster.
RenderScript
Renderscript is a component of the Android operating system for mobile devices. It is a low-level API for intensive computation using heterogeneous computing. It allows developers to maximize the performance of their applications at the cost of writing a greater amount of more complex code. Renderscript offers a high performance computation API at the native level that you write in C (C99 standard). Its main goal is mainly three: portability (Applications need to be able to run on a wide range of hardware without changes), performance (guarantee to provide 60fps, utilize advanced vector operations), usability. NDK
is currently working as a agent to adopt RenderScript inside Android, however, NDK has somewhat limitation as below:
- The Android platform provides a very minimal
C++
runtime support library (/system/lib/libstdc++
) and corresponding headers for it in theNDK
. - By default, this 'system' runtime does not provide: Standard
C++
Library support (except a few trivial headers),C++
exceptions support, RTTI support - The only headers provided here are:
cassert
cctype
cerrno
cfloat
climits
cmath
csetjmp
csignal
cstddef
cstdint
cstdio
cstdlib
cstring
ctime
cwchar
stl_pair
typeinfo
utility
LLVM
is another solution to tackle the limitations of NDK
.
LLVM
LLVM
is not a virtual machine itself anymore; even though its name is VM, it started as a research project from UIUC. LLVM
covers whole compiler infrastructures including C
, C++
, ActionScript
, Ada
, D
, Fortran
, GLSL
, Haskell
, Java bytecode
, Objective-C
, Python
, Ruby
, Rust
, Scala
, C#
, and running.In a nutshell, what
LLVM
does is LLVM
can also generate relocatable machine code at compile-time or link-time or even binary machine code at run-time. Although optimization of LLVM
behaviors during link-time, run-time, compile-time is huge topic, it is beyond the cover of this post. But the bottom line is LLVM
& Clang
provides portability, usability and performance where above native-oriented operation need them. (as explained in RenderScript)
Clang
When we talks about LLVM
, we cannot skip Clang
. Clang
is an LLVM
native C
, C++
, Objective-C
compiler, which aims to deliver fast compiles than classic compiler (e.g. gcc
); And depends on architecture, and the nature of the complexity of the code, it can provide much faster speed for compilation. FYI, Apple populated use of Clang
since Xcode 3.1 and iOS SDK as iOS is using Objective-C
.
Compare to gcc
, Clang
has below benefits:
- Compatible with
gcc
- Lighter, more compact, and more modularized.
- Easier to debug
- Faster (in average)
- Supports
LLVM
- Uses
LLVM
BSD license
So what is GDK
?
In short, GDK
is results of adopting LLVM
inside Android platform. It provides faster, lighter, more compatible native-code operation inside Android platform.You can find more details about
GDK
on below gerrit. It's not even surprised that llcm
is also part of platform.
- https://android-review.googlesource.com/#/admin/projects/platform/gdk
- https://android-review.googlesource.com/#/admin/projects/toolchain/llvm
Links and references
- There is a nice presentation by KAndroid here
- Dalvik on Wiki.
- More on optimization of
dex
: here - More on DTVM on MIPS
- Android RenderScript Google TechTalk
- RenderScript on AndroidDev
NDK
description on AndroidDevNDK
Google group- Homepage for
LLVM
LLVM
blog- LLVMlinux
- Clang on wiki
- Clang project
Tuesday, March 19, 2013
More on Android building
ENG
, USER
, DEBUG
Reference from KAndroid
eng
This is the default flavor. A plain user
userdebug
$ make
is the same as $ make eng
.Installs modules tagged with:
eng
, debug
, user
, and/or development.Installs non-APK modules that have no tags specified.
Installs APKs according to the product definition files, in addition to tagged APKs.
ro.secure=0
ro.debuggable=1
ro.kernel.android.checkjni=1
adb
is enabled by default.$ make user
This is the flavor intended to be the final release bits.Installs modules tagged with user.
Installs non-APK modules that have no tags specified.
Installs APKs according to the product definition files; tags are ignored for APK modules.
ro.secure=1
ro.debuggable=0
adb
is disabled by default.$ make userdebug
The same as user, except:
Also installs modules tagged with debug.ro.debuggable=1
adb
is enabled by default.proguard
In Android.mk
, you can put below to prevent TOO MUCH optimization with dex-opt
.LOCAL_PROGUARD_ENABLED := disabled
Tuesday, March 12, 2013
/dev/null
/dev/null
is one of pseudo-devices from UNIX-like OS.
/dev/null
or the null device is a special file that discards all data written to it (but reports that the write operation succeeded) and provides no data to any process that reads from it (yielding EOF immediately). In programmer jargon, especially Unix jargon, it may also be called the bit bucket or black hole.
/dev/null
Accepts and discards all input; produces no output.
/dev/zero
Accepts and discards all input; produces a continuous stream of NULL (zero value) bytes.
/dev/full
Produces a continuous stream of NULL (zero value) bytes when read, and returns a "disk full" message when written to.
/dev/random
and/dev/urandom
Produces a variable-length stream of pseudo-random or truly random numbers.
fb
: frame bufferfd
: (platform) floppy disks, though this same abbreviation is also commonly used to refer to file descriptorhd
: (“classic”) IDE driver (previously used for ATA hard disk drive, ATAPI optical disc drives, etc.)hda
: the master device on the first ATA channel (usually identified by major number 3 and minor number 0)hdb
: the slave device on the first ATA channelhdc
: the master device on the second ATA channelhdc1
: first partition on this disk (example)hdc5
: first logical drive in the extended partition (example)hdd
: the slave device on the second ATA channellp
: line printers (compare lp)parport
,pp
: parallel portspt
: pseudo-terminals (virtual terminals) SCSI driver, also used by libATA (modern PATA/SATA driver), USB, IEEE 1394, etc.sd
: mass-storage driversda
: first registered devicesda4
: last partition on this disk (example)sda6
: second logical drive in the extended partition (example)ses
: Enclosure driversg
: generic SCSI layersr
: “ROM” driver (data-oriented optical disc drives; scd is just a secondary alias)st
: magnetic tape drivertty
: terminalsttyS
: (platform) serial port driverttyUSB
: USB serial converters, modems, etc.
Wednesday, March 6, 2013
Chrome's SPDY
chrome://flags
Settings - Bandwidth management - Reduce data usage
- Chrome beta for Android
- SPDY on WikiPedia
- Reference page from Chromium project
- Chrome extension of SPDY indicator
Monday, February 25, 2013
How ContentProvider works in Android
ContentProvider
is just a Android version of passing database between multiple processes. It provides encapsulated data passing, while giving IPC between multiple processes.
ContentProvider
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object. Together, providers and provider clients offer a consistent, standard interface to data that also handles inter-process communication and secure data access. Quotes from Android Developer.ContentResolver
When you want to access data in a content provider, you use the - Accessing
ContentProvider
URI
TODO
ContentUri
TODO
Parcel
TODO
Cursor
TODO
Contract
TODO
- MIME
MediaStore
TODO
ContactProvider
TODO
CalendarProvider
TODO
CustomProvider
TODO
Communication between
ContentProvider
and ContentResolver
can act as encapsulated interface, as well as providing IPC between processes (Client which is using ContentProvider
, and process that owns ContentProvider
). Accessing ContentProvider
sometimes requires special permission, and it should be addressed in the Manifest
. Note: If provider does not specify any permission, NO other applications are able to access to the provider. ContentResolver
object in your application's Context
to communicate with the provider as a client. Quotes from Android Developer.
ContentProvider
can be accessed by using ContentResolver
, from below method. public final Cursor query (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
API Level 1.
uri
: The URI, using the content://scheme
, for the content to retrieve.projection
: A list of which columns to return. Passing null will return all columns, which is inefficient.selection
: A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows for the given URI.selectionArgs
: You may include ?s in selection, which will be replaced by the values from selectionArgs, in the order that they appear in the selection. The values will be bound as Strings.sortOrder
: How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered.public final Cursor query (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal)
API Level 16. Same as above method except 1 parameter
cancellationSignal
cancellationSignal: A signal to cancel the operation in progress, or null if none. If the operation is canceled, then OperationCanceledException will be thrown when the query is executed.
Wednesday, January 30, 2013
Android Notification
Notification.Builder()
Notification.Builder()
extends Object
Notification
directly, Notification.Builder()
provides all necessary flags and features for Notification
Here is example usage with all the settings:
new Notification.Builder(this.getApplicationContext())
.setAutoCancel(boolean autoCancel)
.setContent(RemoteViews views)
.setContentInfo(CharSequence info)
.setContentIntent(PendingIntent intent)
.setContentText(CharSequence text)
.setContentTitle(CharSequence title)
.setDefaults(int defaults)
.setDeleteIntent(PendingIntent intent))
.setFullScreenIntent(PendingIntent intent, boolean highPriority)
.setLargeIcon(Bitmap icon)
.setLights(int argb, int onMs, int offMs)
.setNumber(int number)
.setOngoing(boolean ongoing)
.setOnlyAlertOnce(boolean onlyAlertOnce)
.setPriority(int pri)
.setProgress(int max, int progress, boolean indeterminate)
.setShowWhen(boolean show)
.setSmallIcon(int icon, int level)
.setSmallIcon(int icon)
.setSound(Uri sound)
.setSound(Uri sound, int streamType)
.setStyle(Notification.Style style)
.setSubText(CharSequence text)
.setTicker(CharSequence tickerText, RemoteViews views)
.setTicker(CharSequence tickerText)
.setUsesChronometer(boolean b)
.setVibrate(long[] pattern)
.setWhen(long when)
.addAction(int icon, CharSequence title, PendingIntent intent)
.build()
Of course, you do not have to use every settings, as most of them have defaults value, however, you have to specify below elements at least to build Notification
object. A small icon, set by setSmallIcon()
, A title, set by setContentTitle()
Detail text, set by setContentText()
Notification
extends Object
implements Parcelable
Notification
object as we can build it with new Notificaion.Build.build()
. However, since this object is implementing Parcelable
, it provides below 2 method:
void writeToParcel(Parcel parcel, int flags)
Flatten this notification from a parcel.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
NotificationManager
extends Object
Here is general usage of
NotificationManager
Notification mNotification = new Notification.Builder(this.getApplicationContext())
.setBLAH()
.setBLAH()
.setBLAH()
.build()
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mId, mNotification);
mNotificationManager.cancel(mId);
will dismiss based on mId
or you can use .cancelAll()
to simply kill all the notifications.
From the API level 16, Notification supports these styles, which can provides better UI experience; Style
, BigPictureStyle
, InboxStyle
, BigTextStyle
. Each style can take Notification.Builder()
, and it will generate Notification
with build()
method.
Notification.Builder
as a parameter with each Style, and you can find more details in Android Developer .
Wednesday, January 23, 2013
Android build trouble shooting
- Sun JDK 6 installation AOSP needs Sun JDK 6 compiler, however, The Sun JDK is no longer in Ubuntu's main package repository.
Here is solution:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
Oracle JDK download
/external/guava
with SortedMap<K, V> onlyOnLeft = Maps.newTreeMap(comparator);
SortedMap<K, V>
compilation error. To be specific, you can just modify Line number 228-229 with this:
228- public static <C, K extends C, V> TreeMap<K, V> newTreeMap(
229- @Nullable Comparator<C> comparator) {
228+ public static <K, V> TreeMap<K, V> newTreeMap(
229+ @Nullable Comparator<? super K> comparator) {
Friday, January 11, 2013
Native-client
Refers to Native-client from Google Dev.
Static code analysis tool
Refers to Static code analysis from Wikipedia.
Android Kernel building
Refers to Android Open Source Project
This gives all the details about how to build Android kernel & build environment.
Android application development
Refers to Downloading the Source Tree from Android
This gives you useful links for Android application development
Wednesday, January 9, 2013
Chromium project
This only gives basic development setup for Chromium project, not Chromium OS.
For the latest version of Chrome Project, you might wanna use: Chrome Canary (a.k.a. Nightly build)
- Sync tools -
depot tools
Here contains bunch of information for - Sync tools -
gyp
is a acronym for Generate Your Project. For more details: You can refer to gyp on Google Code or gyp Google Groups
- Getting the codes - Here
- ninja build ninja build is build system focused on speed. Here are github page for ninja build, usage for Chromium project, and Google groups for ninja build.
depot_tools
; such as:gclient
, gcl
, git-cl
, hammer
, svn
, drover
, ccplint.py
, presubmit_support.py
, repo
, trychange.py
, git-try
, wtf
, weekly
, git-gs
, zsh-goodies
Android.mk
For more details, refer to:Android NDK Documentation
Common used keywords from Android NDK, Revision 8d (December 2012)Pre-reserved variable names:
- names that begin with
LOCAL_
(e.g.LOCAL_MODULE
) - names that begin with
PRIVATE_
,NDK_
orAPP_
(used internally) - lower-case names (used internally, e.g. '
my-dir
')
Module-description variables:
LOCAL_PATH
This variable is used to give the path of the current file.
LOCAL_MODULE
This is the name of your module. It must be unique among all module names, and shall not contain any space. You MUST define it before including any LOCAL_MODULE_FILENAME
This variable is optional, and allows you to redefine the name of generated files. By default, module <foo> will always generate a static library named lib<foo>.a or a shared library named lib<foo>.so, which are standard Unix conventions. LOCAL_SRC_FILES
This is a list of source files that will be built for your module. Only list the files that will be passed to a compiler, since the build system automatically computes dependencies for you. Note that source files names are all relative to LOCAL_PATH and you can use path components. LOCAL_CPP_EXTENSION
This is an optional variable that can be defined to indicate the file extension of C++ source files. The default is '.cpp' but you can change it.
LOCAL_C_INCLUDES
An optional list of paths, relative to the NDK *root* directory, which will be appended to the include search path when compiling all sources (C, C++ and Assembly).
LOCAL_CFLAGS
An optional set of compiler flags that will be passed when building C *and* C++ source files.
LOCAL_CXXFLAGS
An alias for LOCAL_CPPFLAGS
An optional set of compiler flags that will be passed when building C++ source files *only*. They will appear after the LOCAL_CFLAGS on the compiler's command-line.
LOCAL_STATIC_LIBRARIES
The list of static libraries modules (built with LOCAL_SHARED_LIBRARIES
The list of shared libraries *modules* this module depends on at runtime. This is necessary at link time and to embed the corresponding information in the generated file.
LOCAL_WHOLE_STATIC_LIBRARIES
A variant of LOCAL_LDLIBS
The list of additional linker flags to be used when building your module. This is useful to pass the name of specific system libraries with the "-l" prefix.
LOCAL_ALLOW_UNDEFINED_SYMBOLS
By default, any undefined reference encountered when trying to build a shared library will result in an "undefined symbol" error. This is a great help to catch bugs in your source code.
LOCAL_ARM_MODE
By default, ARM target binaries will be generated in 'thumb' mode, where each instruction are 16-bit wide. You can define this variable to 'arm' if you want to force the generation of the module's object files in 'arm' (32-bit instructions) mode.
LOCAL_ARM_NEON
Defining this variable to 'true' allows the use of ARM Advanced SIMD (a.k.a. NEON) GCC intrinsics in your C and C++ sources, as well as NEON instructions in Assembly files.
LOCAL_DISABLE_NO_EXECUTE
Android NDK r4 added support for the "NX bit" security feature. It is enabled by default, but you can disable it if you *really* need to by setting this variable to 'true'.
LOCAL_EXPORT_CFLAGS
Define this variable to record a set of C/C++ compiler flags that will be added to the LOCAL_CFLAGS definition of any other module that uses this one with LOCAL_EXPORT_CPPFLAGS
Same as LOCAL_EXPORT_C_INCLUDES
Same as LOCAL_EXPORT_LDLIBS
Same as LOCAL_FILTER_ASM
Define this variable to a shell command that will be used to filter the assembly files from, or generated from, your
$(BUILD_XXXX)
script.
NOTE: You should not put a path or file extension in your
LOCAL_MODULE_FILENAME
, these will be handled automatically by the build system.
NOTE: Always use Unix-style forward slashes (/) in build files. Windows-style back-slashes will not be handled properly.
LOCAL_CPPFLAGS
. Note that use of this flag is obsolete as it may disappear in future releases of the NDK.
BUILD_STATIC_LIBRARY
) that should be linked to this module. This only makes sense in shared library modules.
LOCAL_STATIC_LIBRARIES
used to express that the corresponding library module should be used as "whole archives" to the linker. See the GNU linker's documentation for the --whole-archive flag. This is generally useful when there are circular dependencies between several static libraries. Note that when used to build a shared library, this will force all object files from your whole static libraries to be added to the final binary. This is not true when generating executables though.
LOCAL_STATIC_LIBRARIES
or LOCAL_SHARED_LIBRARIES
.
LOCAL_EXPORT_CFLAGS
, but for C++ flags only.
LOCAL_EXPORT_CFLAGS
, but for C include paths. This can be useful if 'bar.c' wants to include headers that are provided by module 'foo'.
LOCAL_EXPORT_CFLAGS
, but for linker flags. Note that the imported linker flags will be appended to your module's LOCAL_LDLIBS
though, due to the way Unix linkers work.
LOCAL_SRC_FILES
.
NDK-provided variables:
$CLEAR_VARS
Points to a build script that undefines nearly all $BUILD_SHARED_LIBRARY
Points to a build script that collects all the information about the module you provided in $BUILD_STATIC_LIBRARY
This is the same as $PREBUILT_SHARED_LIBRARY
Points to a build script used to specify a prebuilt shared library. Unlike $PREBUILT_STATIC_LIBRARY
This is the same as $TARGET_ARCH
Name of the target CPU architecture as it is specified by the full Android open-source build. This is 'arm' for any ARM-compatible build, independent of the CPU architecture revision.
$TARGET_PLATFORM
Name of the target Android platform when this $TARGET_ARCH_ABI
Name of the target CPU+ABI when this $TARGET_ABI
The concatenation of target platform and ABI, it really is defined as
LOCAL_XXX
variables listed in the "Module-description" section below. You must include the script before starting a new module.
LOCAL_XXX
variables and determines how to build a target shared library from the sources you listed. Note that you must have LOCAL_MODULE
and LOCAL_SRC_FILES
defined, at a minimum before including this file. this will generate a file named
lib$(LOCAL_MODULE).so
PREBUILT_SHARED_LIBRARY
, but for a static library file instead.
BUILD_SHARED_LIBRARY
and BUILD_STATIC_LIBRARY
, the value of LOCAL_SRC_FILES
must be a single path to a prebuilt shared library (e.g. foo/libfoo.so), instead of a source file.
PREBUILT_SHARED_LIBRARY
, but for a static library file instead.
Android.mk
is parsed. For example, 'android-3' correspond to Android 1.5 system images.
Android.mk
is parsed. Two values are supported at the moment: armeabi, armeabi-v7a
$(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
and is useful when you want to test against a specific target system image for a real device. By default, this will be 'android-3-armeabi'
NDK-provided function macros:
my-dir
Returns the path of the last included all-subdir-makefiles
Returns a list of this-makefile
Returns the path of the current parent-makefile
Returns the path of the parent grand-parent-makefile
Returns the path of the grand-parent import-module
A function that allows you to find and include the
Makefile
, which typically is the current Android.mk
's directory.
Android.mk
located in all sub-directories of the current 'my-dir
' path.
Makefile
(i.e. where the function is called).
Makefile
in the inclusion tree, i.e. the path of the Makefile
that included the current one.
Makefile
in the inclusion tree.
Android.mk
of another module by name.
Tuesday, January 8, 2013
RoR: get started
Prerequisite
Ruby
Here is interesting quote from the chief designer of Ruby
, Yukihiro MatsumotoOften people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something." They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.
Ruby
is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl
with Smalltalk
-like features. It was also influenced by Eiffel
and Lisp
. Ruby
supports multiple programming paradigms, including functional, object oriented and imperative. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Smalltalk
, Python
, Perl
, Lisp
, Dylan
, and CLU
.Ruby on Rails
a.k.a Rails
Ruby on Rails
a.k.a RailsRuby on Rails
, often simply Rails, is an open source web application framework which runs on the Ruby
programming language. It is a full-stack framework: it allows creating pages and applications that gather information from the web server, talk to or query the database, and render templates out of the box. As a result, Rails features a routing system that is independent of the web server. Ruby on Rails
emphasizes the use of well-known software engineering patterns and principles, such as active record pattern, convention over configuration, don't repeat yourself, and model-view-controller.jRuby
JRuby
is an implementation of the Ruby
programming language atop the Java Virtual Machine, written largely in Java
. It is free software released under a three-way CPL/GPL/LGPL license. JRuby is tightly integrated with Java
to allow the embedding of the interpreter into any Java
application with full two-way access between the Java
and the Ruby
code (similar to Jython
for the Python
language).RubyGems
RubyGems
is just a package manager for the Ruby
programming language that provides a standard format for distributing Ruby
programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.Ruby on Rails
installation:
For Ubuntu (12.10 especially),
$ sudo add-apt install ruby1.9.3
$ sudo gem install rails
$ rails new $PATH
$ cd $PATH
$ rails server
For Mac OS X (Mountain Lion especially),
Install homebrew, then
$ brew install ruby
$ gem install rails
$ rails new $PATH
$ cd $PATH
$ rails server
and that's it! You can check the http://localhost:3000
(by default)If you face any errors with
/var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime.
, try to install nodejs
.
Userful links
- Ruby language
- Try Ruby - Interactive tutorial
- jRuby wiki
- Ruby on rails homepage
- RubyGems homepage
Monday, January 7, 2013
HTML5 on Mobile
HTML5 on Android
Titanium
PhoneGap
Ansca Mobile
Appcelerator
Useful links
envsetup.sh
Refer to: Building the System from Android and Android Build System from KAndroid
envsetup.sh
- lunch: lunch -
- tapas: tapas [ ...] [arm|x86|mips] [eng|userdebug|user]
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir: Go to the directory containing a file.
Tizen build setup
- Setting up Gerrit access Setup Development Environment
- Install GBS and MIC Installing development tools
- Source download Gerrit projects
- Build package
- Build package at remote OBS
- Link to GBS guide
$ gbs build -A ARCH .....
$ cd acl
$ gbs remotebuild -B Tizen:Main