SlideShare a Scribd company logo
1 of 42
A
               seminar on
      “CROSS -COMPILING ANDROID
            APPLICATIONS”




                                                                     2/15/2013
    Guided by:                     Seminar Co-ordinators
Asst.prof. Suresh .T          Asst. H.O.D, Dr. Rajashree V.Biradar
                              Asst. Prof, Gousia Parveen
                              Asst. prof, Sudhakar Avareddy




                        Presented by:
                                                                       1
                       Kotte Sai Krishna
Agenda
• Introduction
• Why android?




                           2/15/2013
• Features of Android
• Android architecture
• Why to cross-
  compile?
• Advantages
• Disadvantages
• Conclusion
• References                 2
Introduction
• Mobile development community is at a tipping point because
  users demand for innovative ideas.




                                                                2/15/2013
• The question was “what would it take to build better mobile
  phone?”.

• Google responded by forming “open handset alliance” in
  November 2007 and named the project as “THE ANDROID
  PROJECT”

• Its members include operators, handset makers, software
  companies, commercialization companies and semiconductor
  companies.                                                      3
Open handset alliance




                        2/15/2013
                          4
• The first android handset was developed by HTC and was
  named as T-Mobile G1.

• Android is hailed as “ The first complete, open, and free
  mobile platform”




                                                              2/15/2013
                                                                5
Why Android?




               2/15/2013
                 6
Features of Android
1. A truly open, free development platform based on Linux and
   open source.




                                                                2/15/2013
    open: open source licensing for developers to develop
   applications.
    Free: Android applications are free to develop.
   complete: Because of it’s secure operating system having
   robust software framework and rich application
   development opportunities.

2. A component-based architecture inspired by Internet
   mashups.
                                                                  7
Parts of one application can be used in another in ways not
 originally envisioned by the developer.
 Ex:-Suppose you want to write an app that tweets your
 current location every 10 minutes throughout the day. You
 can, and it’s easy. Use Android’s location services and a third-
 party Twitter API (such as iTwitter), and you can do just that.




                                                                    2/15/2013
3. Tons of built-in services out of the box
   A full-powered SQL database lets you harness the power of
   local storage for occasionally connected computing and
   synchronization.

4. Automatic management of the application life cycle
   Programs are isolated from each other by multiple layers of
   security, which will provide a level of system stability not
                                                                      8
   seen before in smart phones.
5. Graphics and animation inspired by Flash are melded with
   3D accelerated OpenGL graphics to enable new kinds of
   games and business applications.

6. Portability across a wide range of current and future
   hardware.




                                                              2/15/2013
   All your programs are written in Java and executed by
   Android’s Dalvik virtual machine, so your code will be
   portable on different architectures.

   Support for a variety of input methods such as
   keyboard, touch, and trackball.

   User interface customization.
                                                                9
Android Architecture
The android software stack can be subdivided into five layers:
1) The kernel.




                                                                 2/15/2013
2) Native libraries.
3) Android runtime.
4) Application framework.
5) Applications.




                                                                 10
2/15/2013
11
1.Linux Kernel
• The whole Android OS is built on top of the Linux 2.6 Kernel
  with some further architectural changes made by Google. It is
  this Linux that interacts with the hardware and contains all the




                                                                     2/15/2013
  essential hardware drivers.

• Drivers are programs that control and communicate with the
  hardware.

• It acts as an abstraction layer between hardware and software
  layers.

• The features of Linux kernel include( but aren’t limited to) the
  following:                                                         12
Security model: The Linux kernel handles security between the
application and the system.

Memory management: The kernel handles memory
management for you, leaving you free to develop your app.




                                                                2/15/2013
Process management: The Linux kernel manages processes
well, allocating resources to processes as they need them.

Network stack: The Linux kernel also handles network
communication.

Driver model: The goal of Linux is to ensure that everything
works. Hardware manufacturers can build their drivers into
the Linux build.
                                                                13
2.Libraries
• The next layer is the Android’s native libraries. It is this layer
  that enables the device to handle different types of data.




                                                                       2/15/2013
• written in c or c++ language .

• specific for a particular hardware.

• Some of the native libraries include:
  Surface Manager: It is used for compositing window manager
  with off-screen buffering. This off screen buffer is the reason
  behind the transparency of windows.

                                                                       14
Media framework: Media framework provides different media
codec’s allowing the recording and playback of different media
formats.

SQLite: SQLite is the database engine used in android for data




                                                                 2/15/2013
storage purposes.

Web Kit: It is the browser engine used to display HTML
content.

OpenGL: Used to render 2D or 3D graphics content to the
screen.

Secure socket layer (SSL): These libraries are responsible for
Internet security.                                               15
3.Android runtime
• consists of Dalvik Virtual machine and Core Java libraries.
  Dalvik Virtual Machine




                                                                       2/15/2013
  It is a type of JVM used in android devices to run apps .

 Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class
 files, instead it runs .dex files. .dex files are built from .class
 file at the time of compilation .

 The Dalvik VM allows multiple instance of Virtual machine to
 be created simultaneously providing security, isolation,
 memory management and threading support. It is developed
 by Dan Bornstein of Google.                                           16
2/15/2013
17
Core java libraries
 These are different from Java SE and Java ME libraries.
 However these libraries provide most of the functionalities
 defined in the Java SE libraries.




                                                               2/15/2013
 Dalvik itself is compiled to native code whereas the core
 libraries are written in Java, thus interpreted by Dalvik.




                                                               18
4.Application framework
• These are the blocks that our applications directly interact
  with. These programs manage the basic functions of phone




                                                                 2/15/2013
  like resource management, voice call management etc.

 Blocks of application framework include:
 Activity Manager: Manages the activity life cycle of
 applications.

 Content Providers: Manage the data sharing between
 applications.

                                                                 19
  Telephony Manager: Manages all voice calls.
Location Manager: Location management, using GPS or cell
tower.

Resource Manager: Manage the various types of resources we
use in our Application.




                                                               2/15/2013
View system: Handles the views and layouts that make up your
user interface (UI).




                                                               20
5.Applications
• Applications are the top layer in the Android architecture and
  this is where our applications are going to fit.




                                                                   2/15/2013
• Several standard applications come pre-installed with every
  device, such as:
  1) SMS client app.
  2) Web browser.
  3) Contact manager.



                                                                   21
Why to cross compile?
• A cross compiler is a compiler capable of
  creating executable code for a platform other than the one on




                                                                  2/15/2013
  which the compiler is running.

• Problem: Porting an application to different phones require
  significant effort.

• Solution:
1) Android is used as development platform.
2) Developers need to know only about Android SDK.
3) Applications can then be compiled to their native code.
                                                                  22
Android to iPhone cross-
          compilation
• Apple's iPhone has generated huge interest amongst users
  and developers alike. Like MacOS X, the iPhone development




                                                               2/15/2013
  environment is based on Objective-C as the development
  language and Cocoa Touch for the GUI library.

• The iPhone SDK license agreement does not permit the
  development of a virtual machine.

• “XMLVM” can be used to cross-compile a Java application to
  Objective-C.

• XMLVM- Extensible markup language Virtual machine.           23
XMLVM overview




                 2/15/2013
                 24
• STEPS:
         1) Cross compile java to objective-C.
         2) Create JAVA API for cocoa touch.
         3) Write Android compatibility library on top of Cocoa Touch
  Java API.
         4) Use native SDK Xcode to create executable.




                                                                        2/15/2013
 // Java
Class Calc {
Static int add (int x, int y);
{
return x + y;
}
            }

                                                                        25
XMLVM of Calc.class
<? Xml version="1.0" encoding="UTF-8"?>
<xmlvm xmlns:dex="http://xmlvm.org/dex">
<class name="Calc">




                                             2/15/2013
 <method name="add" isStatic="true">
   <Signature>
      <parameter type="int" />
      <parameter type="int" />
      <return type="int" />
   </signature>
  <dex:code register-size="3">
      <dex:add-int vx="0" vy="1" vz="2" />
      <dex:return vx="0" vx-type="int" />
 </dex:code>
</method>
</class>                                     26
</xmlvm>
Cross-compiling XMLVM to
        objective-C
1) These translations are done using XSLT.




                                                            2/15/2013
2) Mappings exist for different languages.

3) The XSLT excerpt below demonstrates the translation of
<dex:add-int/> (Integer add) to Objective-C.




                                                            27
// Objective-C
typedef union {                      _r0.i = _r1.i + _r2.i
id o;
int i;
float f;
double d;




                                                             2/15/2013
} XMLVMElem;
<! – XSL template -->
<xsl:template match="dex:add-int">
<xsl:text>_r</xsl:text>
<xsl:value-of select="@vx"/>
<xsl:text>.i = _r</xsl:text>
<xsl:value-of select="@vy"/>
<xsl:text>.i + _r</xsl:text>
<xsl:value-of select="@vz"/>
<xsl:text>.i;</xsl:text>
</xsl:template>
                                                             28
Class calc in objective-C
@implementation Calc
+ (int) add___int_int :(int)n1 :(int)n2




                                          2/15/2013
{
XMLVMElem _r0;
XMLVMElem _r1;
XMLVMElem _r2;
_r1.i = n1;
_r2.i = n2;
_r0.i = _r1.i + _r2.i;
return _r0.i;
}
@end                                      29
Android compatibility
      Library




                        2/15/2013
                        30
• The Apple license agreement does not permit the installation
  of a virtual machine on the iPhone. By cross-compiling a Java
  application to a native iPhone application, this restriction of
  the license agreement is therefore not violated.




                                                                    2/15/2013
• Apple only supports Objective-C as the development language
  for the iPhone. The GUI of iPhone applications is based on
  Cocoa Touch.

• If Java is to be used as a development language for iPhone
  applications, two aspects need to be addressed:
  1) The cross-compilation of Java to Objective-C and
  2) A Java API for Cocoa Touch.

                                                                    31
• Android defines its own API for writing mobile applications.
  With the help of XMLVM it is possible to cross-compile Java-
  based Android applications to native iPhone applications.

• The Android application is written in Java and makes use of an
  Android specific API. XMLVM offers a compatibility library,




                                                                   2/15/2013
  written in Java that offers the same API as Android, but only
  makes use of the Java-based API for Cocoa Touch mentioned
  earlier.

• During the cross-compilation process, both the application
  and the Android compatibility library are cross-compiled from
  Java to Objective-C and linked with the Cocoa Touch
  compatibility library to yield a native iPhone application.

                                                                   32
• As can be seen, compared to the Java-for-the-iPhone portion
  of XMLVM, the only additional feature added to support
  Android applications is the Android compatibility library.

 Android Compatibility Library:




                                                                2/15/2013
  – Offers Android API.
  – Device-independent portions of Android.
  – Builds upon a Common Layer API.
  – Written in Java.
  – Is cross-compiled to Objective-C.




                                                                33
XMLVM tool chain




                   2/15/2013
                   34
• XMLVM is a flexible cross-compilation framework.

• Instead of cross-compiling source code of high-level
  programming languages, XMLVM translates byte code
  instructions. Byte code programs are represented by XML
  documents and cross-compiled via XSL stylesheet.




                                                                 2/15/2013
• XMLVM supports byte code instructions from different virtual
  machines:
  1) The Java Virtual Machine (JVM).
  2) The Common Language Runtime (CLR) that is part of the
  .NET framework, and the YARV byte code from Ruby 1.9.



                                                                 35
• Process:
  1) The first step in using XMLVM is to compile a Java or .NET
  source code program to byte code. This is done with a native
  compiler such as Sun Microsystems’s javac or Microsoft's
  Visual Studio.




                                                                    2/15/2013
 2) The resulting byte code program (either a Java .class file or
 a .NET .exe file) is fed into the XMLVM tool chain where it is
 first converted to XML.

 3) XMLVMJVM denotes an XMLVM program that contains JVM
 byte code instructions.

 4) XMLVMDEX makes use of Android's DEX instructions for
 Dalvik that is particularly suitable for generating source of      36
 other high-level programming languages.
Advantages
• Android API offer good support for different screen
  resolutions.




                                                        2/15/2013
• Cross-compilation of games is feasible.
• Leverage existing Android/Java skills.
• Only knowledge of a single platform is required.
• Reduces development costs.
• Shortens time-to-market.




                                                        37
Disadvantages
• Hard to test the result.
    The test suite is often part of the source. You didn't build the




                                                                       2/15/2013
  source on the target, so you have to copy the source to the
  target. Then to run its test suite you need to cross-compile
  test suite and install it to the target's root file system.

• Cross compiling restricts developer skills.

• Platform fragmentation is an issue for Android OS devices.
  Vendors do not have uniform policies with respect to OS
  upgrades and version control, so new application releases may
  not work reliably across all Android devices which cause             38
  disruptions in cross compiling process.
Conclusion
•   Immediate benefits of cross-compiling solutions.
•   Strong fragmentation of market for mobile device platforms.




                                                                  2/15/2013
•   Cross-Platform frameworks try to bridge the gap.
•   No tool fulfills all requirements.
•   In some case: instead of “Write once, run everywhere” it‘s
    more “Write once, run many”.




                                                                  39
References
[1] Arno Puder, Oren Antebi, "Cross-Compiling Android
  Applications to IOS and Windows Phone 7" from Mobile
  networks and applications February 2013,volume 18,issue




                                                              2/15/2013
  1,pp 3-21.

[2] EDUCASE learning initiative "7 things you need to know
  about Android".

[3] Dr. Ing. Thomas Springer Technische Universitat Dresden
  Chair of Computer Networks "Cross-Platform development".

[4] “Android Application development for dummies” by Donn
  Felker with Joshua Dobbs, Wiley publishing Inc.             40
• Video reference:    http://www.youtube.com/watch?v=TG-
  NIt2O5J8 by Arno Puder.




                                                           2/15/2013
                                                           41
Thank you




            2/15/2013
            42

More Related Content

What's hot (20)

C++ compilation process
C++ compilation processC++ compilation process
C++ compilation process
 
GCC compiler
GCC compilerGCC compiler
GCC compiler
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
 
Features of the Modern C++ 20
Features of the Modern C++ 20Features of the Modern C++ 20
Features of the Modern C++ 20
 
C++ Coroutines
C++ CoroutinesC++ Coroutines
C++ Coroutines
 
android menus
android menusandroid menus
android menus
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#
 
C fundamental
C fundamentalC fundamental
C fundamental
 
STL in C++
STL in C++STL in C++
STL in C++
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
sSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptxsSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptx
 
Advance Java Programming (CM5I) 6.Servlet
Advance Java Programming (CM5I) 6.ServletAdvance Java Programming (CM5I) 6.Servlet
Advance Java Programming (CM5I) 6.Servlet
 
ASP.NET Brief History
ASP.NET Brief HistoryASP.NET Brief History
ASP.NET Brief History
 
File in C language
File in C languageFile in C language
File in C language
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 

Viewers also liked

compiler and their types
compiler and their typescompiler and their types
compiler and their typespatchamounika7
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerAbha Damani
 
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...Raphaël Kueny
 

Viewers also liked (7)

أرابيسك 2010
أرابيسك 2010أرابيسك 2010
أرابيسك 2010
 
Compiler
CompilerCompiler
Compiler
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Compilers
CompilersCompilers
Compilers
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...
Introduction au développement mobile avec Titanium Appcelerator @ Human Talks...
 

Similar to Cross compiling android applications

Similar to Cross compiling android applications (20)

UNIT-1 INTRODUCTION TO ANDROID [Autosaved].pptx
UNIT-1 INTRODUCTION TO ANDROID [Autosaved].pptxUNIT-1 INTRODUCTION TO ANDROID [Autosaved].pptx
UNIT-1 INTRODUCTION TO ANDROID [Autosaved].pptx
 
Android
AndroidAndroid
Android
 
Android 130923124440-phpapp01
Android 130923124440-phpapp01Android 130923124440-phpapp01
Android 130923124440-phpapp01
 
Android Technology
Android TechnologyAndroid Technology
Android Technology
 
Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
 
document
documentdocument
document
 
Android platform
Android platform Android platform
Android platform
 
Android
AndroidAndroid
Android
 
Android Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdfAndroid Seminar BY Suleman Khan.pdf
Android Seminar BY Suleman Khan.pdf
 
Android Applications
Android ApplicationsAndroid Applications
Android Applications
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android ppt
Android ppt Android ppt
Android ppt
 
Android : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile DevicesAndroid : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile Devices
 
Android operating system
Android operating systemAndroid operating system
Android operating system
 
Android
AndroidAndroid
Android
 
Android
Android Android
Android
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android App Developement
Android App DevelopementAndroid App Developement
Android App Developement
 
Getting started with android
Getting started with androidGetting started with android
Getting started with android
 

Recently uploaded

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

Cross compiling android applications

  • 1. A seminar on “CROSS -COMPILING ANDROID APPLICATIONS” 2/15/2013 Guided by: Seminar Co-ordinators Asst.prof. Suresh .T Asst. H.O.D, Dr. Rajashree V.Biradar Asst. Prof, Gousia Parveen Asst. prof, Sudhakar Avareddy Presented by: 1 Kotte Sai Krishna
  • 2. Agenda • Introduction • Why android? 2/15/2013 • Features of Android • Android architecture • Why to cross- compile? • Advantages • Disadvantages • Conclusion • References 2
  • 3. Introduction • Mobile development community is at a tipping point because users demand for innovative ideas. 2/15/2013 • The question was “what would it take to build better mobile phone?”. • Google responded by forming “open handset alliance” in November 2007 and named the project as “THE ANDROID PROJECT” • Its members include operators, handset makers, software companies, commercialization companies and semiconductor companies. 3
  • 4. Open handset alliance 2/15/2013 4
  • 5. • The first android handset was developed by HTC and was named as T-Mobile G1. • Android is hailed as “ The first complete, open, and free mobile platform” 2/15/2013 5
  • 6. Why Android? 2/15/2013 6
  • 7. Features of Android 1. A truly open, free development platform based on Linux and open source. 2/15/2013 open: open source licensing for developers to develop applications. Free: Android applications are free to develop. complete: Because of it’s secure operating system having robust software framework and rich application development opportunities. 2. A component-based architecture inspired by Internet mashups. 7
  • 8. Parts of one application can be used in another in ways not originally envisioned by the developer. Ex:-Suppose you want to write an app that tweets your current location every 10 minutes throughout the day. You can, and it’s easy. Use Android’s location services and a third- party Twitter API (such as iTwitter), and you can do just that. 2/15/2013 3. Tons of built-in services out of the box A full-powered SQL database lets you harness the power of local storage for occasionally connected computing and synchronization. 4. Automatic management of the application life cycle Programs are isolated from each other by multiple layers of security, which will provide a level of system stability not 8 seen before in smart phones.
  • 9. 5. Graphics and animation inspired by Flash are melded with 3D accelerated OpenGL graphics to enable new kinds of games and business applications. 6. Portability across a wide range of current and future hardware. 2/15/2013 All your programs are written in Java and executed by Android’s Dalvik virtual machine, so your code will be portable on different architectures. Support for a variety of input methods such as keyboard, touch, and trackball. User interface customization. 9
  • 10. Android Architecture The android software stack can be subdivided into five layers: 1) The kernel. 2/15/2013 2) Native libraries. 3) Android runtime. 4) Application framework. 5) Applications. 10
  • 12. 1.Linux Kernel • The whole Android OS is built on top of the Linux 2.6 Kernel with some further architectural changes made by Google. It is this Linux that interacts with the hardware and contains all the 2/15/2013 essential hardware drivers. • Drivers are programs that control and communicate with the hardware. • It acts as an abstraction layer between hardware and software layers. • The features of Linux kernel include( but aren’t limited to) the following: 12
  • 13. Security model: The Linux kernel handles security between the application and the system. Memory management: The kernel handles memory management for you, leaving you free to develop your app. 2/15/2013 Process management: The Linux kernel manages processes well, allocating resources to processes as they need them. Network stack: The Linux kernel also handles network communication. Driver model: The goal of Linux is to ensure that everything works. Hardware manufacturers can build their drivers into the Linux build. 13
  • 14. 2.Libraries • The next layer is the Android’s native libraries. It is this layer that enables the device to handle different types of data. 2/15/2013 • written in c or c++ language . • specific for a particular hardware. • Some of the native libraries include: Surface Manager: It is used for compositing window manager with off-screen buffering. This off screen buffer is the reason behind the transparency of windows. 14
  • 15. Media framework: Media framework provides different media codec’s allowing the recording and playback of different media formats. SQLite: SQLite is the database engine used in android for data 2/15/2013 storage purposes. Web Kit: It is the browser engine used to display HTML content. OpenGL: Used to render 2D or 3D graphics content to the screen. Secure socket layer (SSL): These libraries are responsible for Internet security. 15
  • 16. 3.Android runtime • consists of Dalvik Virtual machine and Core Java libraries. Dalvik Virtual Machine 2/15/2013 It is a type of JVM used in android devices to run apps . Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built from .class file at the time of compilation . The Dalvik VM allows multiple instance of Virtual machine to be created simultaneously providing security, isolation, memory management and threading support. It is developed by Dan Bornstein of Google. 16
  • 18. Core java libraries These are different from Java SE and Java ME libraries. However these libraries provide most of the functionalities defined in the Java SE libraries. 2/15/2013 Dalvik itself is compiled to native code whereas the core libraries are written in Java, thus interpreted by Dalvik. 18
  • 19. 4.Application framework • These are the blocks that our applications directly interact with. These programs manage the basic functions of phone 2/15/2013 like resource management, voice call management etc. Blocks of application framework include: Activity Manager: Manages the activity life cycle of applications. Content Providers: Manage the data sharing between applications. 19 Telephony Manager: Manages all voice calls.
  • 20. Location Manager: Location management, using GPS or cell tower. Resource Manager: Manage the various types of resources we use in our Application. 2/15/2013 View system: Handles the views and layouts that make up your user interface (UI). 20
  • 21. 5.Applications • Applications are the top layer in the Android architecture and this is where our applications are going to fit. 2/15/2013 • Several standard applications come pre-installed with every device, such as: 1) SMS client app. 2) Web browser. 3) Contact manager. 21
  • 22. Why to cross compile? • A cross compiler is a compiler capable of creating executable code for a platform other than the one on 2/15/2013 which the compiler is running. • Problem: Porting an application to different phones require significant effort. • Solution: 1) Android is used as development platform. 2) Developers need to know only about Android SDK. 3) Applications can then be compiled to their native code. 22
  • 23. Android to iPhone cross- compilation • Apple's iPhone has generated huge interest amongst users and developers alike. Like MacOS X, the iPhone development 2/15/2013 environment is based on Objective-C as the development language and Cocoa Touch for the GUI library. • The iPhone SDK license agreement does not permit the development of a virtual machine. • “XMLVM” can be used to cross-compile a Java application to Objective-C. • XMLVM- Extensible markup language Virtual machine. 23
  • 24. XMLVM overview 2/15/2013 24
  • 25. • STEPS: 1) Cross compile java to objective-C. 2) Create JAVA API for cocoa touch. 3) Write Android compatibility library on top of Cocoa Touch Java API. 4) Use native SDK Xcode to create executable. 2/15/2013 // Java Class Calc { Static int add (int x, int y); { return x + y; } } 25
  • 26. XMLVM of Calc.class <? Xml version="1.0" encoding="UTF-8"?> <xmlvm xmlns:dex="http://xmlvm.org/dex"> <class name="Calc"> 2/15/2013 <method name="add" isStatic="true"> <Signature> <parameter type="int" /> <parameter type="int" /> <return type="int" /> </signature> <dex:code register-size="3"> <dex:add-int vx="0" vy="1" vz="2" /> <dex:return vx="0" vx-type="int" /> </dex:code> </method> </class> 26 </xmlvm>
  • 27. Cross-compiling XMLVM to objective-C 1) These translations are done using XSLT. 2/15/2013 2) Mappings exist for different languages. 3) The XSLT excerpt below demonstrates the translation of <dex:add-int/> (Integer add) to Objective-C. 27
  • 28. // Objective-C typedef union { _r0.i = _r1.i + _r2.i id o; int i; float f; double d; 2/15/2013 } XMLVMElem; <! – XSL template --> <xsl:template match="dex:add-int"> <xsl:text>_r</xsl:text> <xsl:value-of select="@vx"/> <xsl:text>.i = _r</xsl:text> <xsl:value-of select="@vy"/> <xsl:text>.i + _r</xsl:text> <xsl:value-of select="@vz"/> <xsl:text>.i;</xsl:text> </xsl:template> 28
  • 29. Class calc in objective-C @implementation Calc + (int) add___int_int :(int)n1 :(int)n2 2/15/2013 { XMLVMElem _r0; XMLVMElem _r1; XMLVMElem _r2; _r1.i = n1; _r2.i = n2; _r0.i = _r1.i + _r2.i; return _r0.i; } @end 29
  • 30. Android compatibility Library 2/15/2013 30
  • 31. • The Apple license agreement does not permit the installation of a virtual machine on the iPhone. By cross-compiling a Java application to a native iPhone application, this restriction of the license agreement is therefore not violated. 2/15/2013 • Apple only supports Objective-C as the development language for the iPhone. The GUI of iPhone applications is based on Cocoa Touch. • If Java is to be used as a development language for iPhone applications, two aspects need to be addressed: 1) The cross-compilation of Java to Objective-C and 2) A Java API for Cocoa Touch. 31
  • 32. • Android defines its own API for writing mobile applications. With the help of XMLVM it is possible to cross-compile Java- based Android applications to native iPhone applications. • The Android application is written in Java and makes use of an Android specific API. XMLVM offers a compatibility library, 2/15/2013 written in Java that offers the same API as Android, but only makes use of the Java-based API for Cocoa Touch mentioned earlier. • During the cross-compilation process, both the application and the Android compatibility library are cross-compiled from Java to Objective-C and linked with the Cocoa Touch compatibility library to yield a native iPhone application. 32
  • 33. • As can be seen, compared to the Java-for-the-iPhone portion of XMLVM, the only additional feature added to support Android applications is the Android compatibility library. Android Compatibility Library: 2/15/2013 – Offers Android API. – Device-independent portions of Android. – Builds upon a Common Layer API. – Written in Java. – Is cross-compiled to Objective-C. 33
  • 34. XMLVM tool chain 2/15/2013 34
  • 35. • XMLVM is a flexible cross-compilation framework. • Instead of cross-compiling source code of high-level programming languages, XMLVM translates byte code instructions. Byte code programs are represented by XML documents and cross-compiled via XSL stylesheet. 2/15/2013 • XMLVM supports byte code instructions from different virtual machines: 1) The Java Virtual Machine (JVM). 2) The Common Language Runtime (CLR) that is part of the .NET framework, and the YARV byte code from Ruby 1.9. 35
  • 36. • Process: 1) The first step in using XMLVM is to compile a Java or .NET source code program to byte code. This is done with a native compiler such as Sun Microsystems’s javac or Microsoft's Visual Studio. 2/15/2013 2) The resulting byte code program (either a Java .class file or a .NET .exe file) is fed into the XMLVM tool chain where it is first converted to XML. 3) XMLVMJVM denotes an XMLVM program that contains JVM byte code instructions. 4) XMLVMDEX makes use of Android's DEX instructions for Dalvik that is particularly suitable for generating source of 36 other high-level programming languages.
  • 37. Advantages • Android API offer good support for different screen resolutions. 2/15/2013 • Cross-compilation of games is feasible. • Leverage existing Android/Java skills. • Only knowledge of a single platform is required. • Reduces development costs. • Shortens time-to-market. 37
  • 38. Disadvantages • Hard to test the result. The test suite is often part of the source. You didn't build the 2/15/2013 source on the target, so you have to copy the source to the target. Then to run its test suite you need to cross-compile test suite and install it to the target's root file system. • Cross compiling restricts developer skills. • Platform fragmentation is an issue for Android OS devices. Vendors do not have uniform policies with respect to OS upgrades and version control, so new application releases may not work reliably across all Android devices which cause 38 disruptions in cross compiling process.
  • 39. Conclusion • Immediate benefits of cross-compiling solutions. • Strong fragmentation of market for mobile device platforms. 2/15/2013 • Cross-Platform frameworks try to bridge the gap. • No tool fulfills all requirements. • In some case: instead of “Write once, run everywhere” it‘s more “Write once, run many”. 39
  • 40. References [1] Arno Puder, Oren Antebi, "Cross-Compiling Android Applications to IOS and Windows Phone 7" from Mobile networks and applications February 2013,volume 18,issue 2/15/2013 1,pp 3-21. [2] EDUCASE learning initiative "7 things you need to know about Android". [3] Dr. Ing. Thomas Springer Technische Universitat Dresden Chair of Computer Networks "Cross-Platform development". [4] “Android Application development for dummies” by Donn Felker with Joshua Dobbs, Wiley publishing Inc. 40
  • 41. • Video reference: http://www.youtube.com/watch?v=TG- NIt2O5J8 by Arno Puder. 2/15/2013 41
  • 42. Thank you 2/15/2013 42