SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Incremental model
Incremental modelIncremental model
Incremental modelHpibmx
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignAkhil Kaushik
 
Software Engineering Process Models
Software Engineering Process Models Software Engineering Process Models
Software Engineering Process Models Satya P. Joshi
 
Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented DesignSharath g
 
V model in software testing
V model in software testingV model in software testing
V model in software testingAbdullah Al Rumy
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)shalinikarunakaran1
 
20160331_Automate the boring stuff with python
20160331_Automate the boring stuff with python20160331_Automate the boring stuff with python
20160331_Automate the boring stuff with pythonSungman Jang
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design MAHASREEM
 
Application of computer graphics and input devices
Application of computer graphics and input devicesApplication of computer graphics and input devices
Application of computer graphics and input devicesMani Kanth
 
Software Process Improvement
Software Process ImprovementSoftware Process Improvement
Software Process ImprovementBilal Shah
 
Software Development Life Cycle
Software Development Life CycleSoftware Development Life Cycle
Software Development Life CycleSlideshare
 
Pressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-modelsPressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-modelsNoor Ul Hudda Memon
 
Component and Deployment Diagram - Brief Overview
Component and Deployment Diagram - Brief OverviewComponent and Deployment Diagram - Brief Overview
Component and Deployment Diagram - Brief OverviewRajiv Kumar
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]Daffodil International University
 
Phased life cycle model
Phased life cycle modelPhased life cycle model
Phased life cycle modelStephennancy
 

Tendances (20)

Incremental model
Incremental modelIncremental model
Incremental model
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
Software Engineering Process Models
Software Engineering Process Models Software Engineering Process Models
Software Engineering Process Models
 
Software process
Software processSoftware process
Software process
 
Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented Design
 
Unified process Model
Unified process ModelUnified process Model
Unified process Model
 
V model in software testing
V model in software testingV model in software testing
V model in software testing
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
 
Unified Process
Unified Process Unified Process
Unified Process
 
20160331_Automate the boring stuff with python
20160331_Automate the boring stuff with python20160331_Automate the boring stuff with python
20160331_Automate the boring stuff with python
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Application of computer graphics and input devices
Application of computer graphics and input devicesApplication of computer graphics and input devices
Application of computer graphics and input devices
 
Software Architecture
Software ArchitectureSoftware Architecture
Software Architecture
 
Software Process Improvement
Software Process ImprovementSoftware Process Improvement
Software Process Improvement
 
Software Development Life Cycle
Software Development Life CycleSoftware Development Life Cycle
Software Development Life Cycle
 
Compilers
CompilersCompilers
Compilers
 
Pressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-modelsPressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-models
 
Component and Deployment Diagram - Brief Overview
Component and Deployment Diagram - Brief OverviewComponent and Deployment Diagram - Brief Overview
Component and Deployment Diagram - Brief Overview
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]
 
Phased life cycle model
Phased life cycle modelPhased life cycle model
Phased life cycle model
 

En vedette

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
 

En vedette (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...
 

Similaire à Cross compiling android applications

Similaire à 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 ppt
Android ppt Android ppt
Android ppt
 
Android Applications
Android ApplicationsAndroid Applications
Android Applications
 
Android ppt
Android pptAndroid 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
 

Dernier

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Dernier (20)

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

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