Software:Android software development

From HandWiki
Short description: Process of writing software for Android operating system
The Android stack[1]
[1]The Nexus 4, part of the Google Nexus series, a line of "developer-friendly" devices[2]

Android software development is the process by which applications are created for devices running the Android operating system. Google states that[3] "Android apps can be written using Kotlin, Java, and C++ languages" using the Android software development kit (SDK), while using other languages is also possible. All non-JVM languages, such as Go, JavaScript, C, C++ or assembly, need the help of JVM language code, that may be supplied by tools, likely with restricted API support. Some programming languages and tools allow cross-platform app support (i.e. for both Android and iOS). Third party tools, development environments, and language support have also continued to evolve and expand since the initial SDK was released in 2008. The official Android app distribution mechanism to end users is Google Play; it also allows staged gradual app release, as well as distribution of pre-release app versions to testers.

Official development tools

Android SDK

Android SDK
Developer(s)Google
Initial releaseOctober 2009; 14 years ago (2009-10)
Stable release
26.1.1 / September 2017; 6 years ago (2017-09)[4]
Written inJava
Operating systemCross-platform
Available inEnglish
TypeIDE, SDK
Websitedeveloper.android.com/sdk/index.html

The Android software development kit (SDK) includes a comprehensive set of development tools.[5] These include a debugger, libraries, a handset emulator based on QEMU, documentation, sample code, and tutorials. Currently supported development platforms include computers running Linux (any modern desktop Linux distribution), Mac OS X 10.5.8 or later, and Windows 7 or later. (As of March 2015), the SDK is not available on Android itself, but software development is possible by using specialized Android applications.[6][7][8]

Until around the end of 2014, the officially-supported integrated development environment (IDE) was Eclipse using the Android Development Tools (ADT) Plugin.[9] As of 2015, Android Studio,[10] is the official IDE; however, developers are free to use others, but Google made it clear that ADT was officially deprecated since the end of 2015 to focus on Android Studio as the official Android IDE. Additionally, developers may use any text editor to edit Java and XML files, then use command line tools (Java Development Kit and Apache Ant are required) to create, build and debug Android applications as well as control attached Android devices (e.g., triggering a reboot, installing software package(s) remotely).[11][6]

Enhancements to Android's SDK go hand-in-hand with the overall Android platform development. The SDK also supports older versions of the Android platform in case developers wish to target their applications at older devices. Development tools are downloadable components, so after one has downloaded the latest version and platform, older platforms and tools can also be downloaded for compatibility testing.[12]

Android applications are packaged in .apk format and stored under /data/app folder on the Android OS (the folder is accessible only to the root user for security reasons). APK package contains .dex files[13] (compiled byte code files called Dalvik executables), resource files, etc.

Android SDK Platform Tools

The Android SDK Platform Tools are a separately downloadable subset of the full SDK, consisting of command-line tools such as adb and fastboot.

Android Debug Bridge (ADB)

The Android Debug Bridge (ADB) is a tool to run commands on a connected Android device. The adbd daemon runs on the device, and the adb client starts a background server to multiplex commands sent to devices. In addition to the command-line interface,[14] numerous graphical user interfaces exist to control adb.

The format for issuing commands is typically:

adb [-d|-e|-s <serialNumber>] <command>
where -d is the option for specifying the single USB-attached device,
      -e for the single running Android emulator on the computer,
      -s for specifying a USB-attached device by its unique serial number.
If there is only one attached device or running emulator, these options are not necessary.

For example, Android applications can be saved by the command backup to a file, whose name is backup.ab by default.[15]

In a security issue reported in March 2011, ADB was targeted as a vector to attempt to install a rootkit on connected phones using a "resource exhaustion attack".[16]

Fastboot

Fastboot is a protocol[17] and it has a tool with the same name included with the Android SDK package used primarily to modify the flash filesystem via a USB connection from host computer. It requires that the device be started in a boot loader or Secondary Program Loader mode, in which only the most basic hardware initialization is performed. After enabling the protocol on the device itself, it will accept a specific set of commands sent to it via USB using a command line.[18] Some of the most commonly used fastboot commands include:

  • flash – rewrites a partition with a binary image stored on the host computer.
  • erase – erases a specific partition.
  • reboot – reboots the device into either the main operating system, the system recovery partition or back into its boot loader.
  • devices – displays a list of all devices (with the serial number) connected to the host computer.
  • format – formats a specific partition; the file system of the partition must be recognized by the device.

Android NDK

Android NDK
Developer(s)Google
Initial releaseJune 2009; 14 years ago (2009-06)[19]
Stable release
r22 / December 2020; 3 years ago (2020-12)[19]
Written inC and C++
Operating system
PlatformIA-32 (Windows only) or x86-64 (Windows,[20] macOS and Linux)
Available inEnglish
TypeSDK
Websitedeveloper.android.com/ndk/

Code written in C/C++ can be compiled to ARM, or x86 native code (or their 64-bit variants) using the Android Native Development Kit (NDK). The NDK uses the Clang compiler to compile C/C++. GCC was included until NDK r17, but removed in r18 in 2018.

Native libraries can be called from Java code running under the Android Runtime using System.loadLibrary, part of the standard Android Java classes.[21][22]

Command-line tools can be compiled with the NDK and installed using adb.[23]

Android uses Bionic as its C library, and the LLVM libc++ as its C++ Standard Library. The NDK also includes a variety of other APIs:[24] zlib compression, OpenGL ES or Vulkan graphics, OpenSL ES audio, and various Android-specific APIs for things like logging, access to cameras, or accelerating neural networks.

The NDK includes support for CMake and its own ndk-build (based on GNU Make). Android Studio supports running either of these from Gradle. Other third-party tools allow integrating the NDK into Eclipse[25] and Visual Studio.[26]

For CPU profiling, the NDK also includes simpleperf[27] which is similar to the Linux perf tool, but with better support for Android and specifically for mixed Java/C++ stacks.

Android Open Accessory Development Kit

The Android 3.1 platform (also backported to Android 2.3.4) introduces Android Open Accessory support, which allows external USB hardware (an Android USB accessory) to interact with an Android-powered device in a special "accessory" mode. When an Android-powered device is in accessory mode, the connected accessory acts as the USB host (powers the bus and enumerates devices) and the Android-powered device acts as the USB device. Android USB accessories are specifically designed to attach to Android-powered devices and adhere to a simple protocol (Android accessory protocol) that allows them to detect Android-powered devices that support accessory mode.[28]

External hardware development

Development tools intended to help an Android device interact with external electronics include IOIO, Android Open Accessory Development Kit, Microbridge, Triggertrap, etc.

Android Developer Challenge

The Android Developer Challenge was a competition to find the most innovative application for Android. Google offered prizes totaling 10 million US dollars, distributed between ADC I and ADC II. ADC I accepted submissions from January 2 to April 14, 2008. The 50 most promising entries, announced on May 12, 2008, each received a $25,000 award to further development.[29][30] It ended in early September with the announcement of ten teams that received $275,000 each, and ten teams that received $100,000 each.[31]

ADC II was announced on May 27, 2009.[32] The first round of the ADC II closed on October 6, 2009.[33] The first-round winners of ADC II comprising the top 200 applications were announced on November 5, 2009. Voting for the second round also opened on the same day and ended on November 25. Google announced the top winners of ADC II on November 30, with SweetDreams, What the Doodle!? and WaveSecure being nominated the overall winners of the challenge.[34][35]

Community-based distributions

There is a community of open-source enthusiasts that build and share Android-based distributions (i.e. firmware) with a number of customizations and additional features, such as FLAC lossless audio support and the ability to store downloaded applications on the microSD card.[36] This usually involves rooting the device. Rooting allows users root access to the operating system, enabling full control of the phone. Rooting has several disadvantages as well, including increased risk of hacking, high chances of bricking, losing warranty, increased virus attack risks, etc.[37] It is also possible to install custom firmware, although the device's boot loader must also be unlocked. Custom firmware allows users of older phones to use applications available only on newer releases.[38]

Those firmware packages are updated frequently, incorporate elements of Android functionality that haven't yet been officially released within a carrier-sanctioned firmware, and tend to have fewer limitations. CyanogenMod and OMFGB are examples of such firmware.

On September 24, 2009, Google issued a cease and desist letter[39] to the modder Cyanogen, citing issues with the re-distribution of Google's closed-source applications[40] within the custom firmware. Even though most of Android OS is open source, phones come packaged with closed-source Google applications for functionality such as the Google Play and GPS navigation. Google has asserted that these applications can only be provided through approved distribution channels by licensed distributors. Cyanogen complied with Google's license and continued to distribute its mod without the proprietary software. It provided a method to backup licensed Google applications during the mod's install process and restore them when the process is complete.[41]

Java standards

Obstacles to development include the fact that Android does not use established Java standards, that is, Java SE and ME. This prevents compatibility between Java applications written for those platforms and those written for the Android platform. Android reuses the Java language syntax and semantics, but it does not provide the full class libraries and APIs bundled with Java SE or ME.[42] However, there are multiple tools in the market from companies such as Myriad Group and UpOnTek that provide Java ME to Android conversion services.[43][44][45]

Android provides its own GUI classes, and does not provide Java AWT, Swing or JavaFX. It does not support the full Java Beans API.[citation needed]

History and market share

Android was created by the Open Handset Alliance, which is led by Google. The early feedback on developing applications for the Android platform was mixed.[46] Issues cited include bugs, lack of documentation, inadequate QA infrastructure, and no public issue-tracking system. (Google announced an issue tracker on January 18, 2008.)[47] In December 2007, MergeLab mobile startup founder Adam MacBeth stated, "Functionality is not there, is poorly documented or just doesn't work... It's clearly not ready for prime time."[48] Despite this, Android-targeted applications began to appear the week after the platform was announced. The first publicly available application was the Snake game.[49][50]

A preview release of the Android SDK was released on November 12, 2007. On July 15, 2008, the Android Developer Challenge Team accidentally sent an email to all entrants in the Android Developer Challenge announcing that a new release of the SDK was available in a "private" download area. The email was intended for winners of the first round of the Android Developer Challenge. The revelation that Google was supplying new SDK releases to some developers and not others (and keeping this arrangement private) led to widely reported frustration within the Android developer community at the time.[51]

On August 18, 2008, the Android 0.9 SDK beta was released. This release provided an updated and extended API, improved development tools and an updated design for the home screen. Detailed instructions for upgrading are available to those already working with an earlier release.[52] On September 23, 2008, the Android 1.0 SDK (Release 1) was released.[53] According to the release notes, it included "mainly bug fixes, although some smaller features were added." It also included several API changes from the 0.9 version. Multiple versions have been released since it was developed.[54]

On December 5, 2008, Google announced the first Android Dev Phone, a SIM-unlocked and hardware-unlocked device that is designed for advanced developers. It was a modified version of HTC's Dream phone. While developers can use regular consumer devices to test and use their applications, some developers may choose a dedicated unlocked or no-contract device.

(As of July 2013), more than one million applications have been developed for Android,[55] with over 25 billion downloads.[56][57] A June 2011 research indicated that over 67% of mobile developers used the platform, at the time of publication.[58] Android smartphone shipments are forecast to exceed 1.2 billion units in 2018 with an 85% market share.[59]

See also

  • Android Studio
  • List of free and open source Android applications
  • Rooting (Android OS)

References

  1. 1.0 1.1 "The Android Source Code". https://source.android.com/source/index.html. 
  2. Syed H (September 24, 2012). "Editorial: Why You Should Go Nexus". Droid Lessons. http://droidlessons.com/why-you-should-go-nexus-opinion-2/. 
  3. "Application Fundamentals". https://developer.android.com/guide/components/fundamentals. 
  4. "SDK Tools | Android Developers". Developer.android.com. https://developer.android.com/tools/sdk/tools-notes.html. 
  5. "Tools Overview". Android Developers. July 21, 2009. http://developer.android.com/guide/developing/tools/index.html. 
  6. 6.0 6.1 appfour. "AIDE- IDE for Android Java C++ - Android Apps on Google Play". google.com. https://play.google.com/store/apps/details?id=com.aide.ui. 
  7. gesturedevelop. "Java Editor - Android Apps on Google Play". google.com. https://play.google.com/store/apps/details?id=air.JavaEditor. 
  8. Tanapro GmbH, Tom Arn. "JavaIDEdroid - Android Apps on Google Play". google.com. https://play.google.com/store/apps/details?id=ch.tanapro.JavaIDEdroid. 
  9. "NBAndroid Plugin". http://plugins.netbeans.org/plugin/19545/nbandroid. 
  10. "Android Studio". https://developer.android.com/studio. 
  11. Westfall, Jon (August 25, 2009). "Backup & Restore Android Apps Using ADB". JonWestfall.com. http://jonwestfall.com/2009/08/backup-restore-android-apps-using-adb/. 
  12. "SDK Tools release notes". https://developer.android.com/studio/releases/sdk-tools. 
  13. "Glossary". https://developer.android.com/guide/appendix/glossary. 
  14. "Android Debug Bridge | Android Developers" Accessed December 27, 2012
  15. Jack Wallen (2015-03-06). "How to create a full backup of your Android device without root". http://www.techrepublic.com/article/how-to-create-a-full-backup-of-your-android-device-without-root/. 
  16. Lemos, Robert "Open source vulnerabilities paint a target on Android"
  17. "Fastboot Protocol Documentation". https://android.googlesource.com/platform/system/core/+/refs/heads/master/fastboot/README.md. 
  18. Ravenscraft, Eric (2014-06-13). "The Most Useful Things You Can Do with ADB and Fastboot on Android" (in en). https://lifehacker.com/the-most-useful-things-you-can-do-with-adb-and-fastboot-1590337225. 
  19. 19.0 19.1 "Android NDK | Android Developers". Developer.android.com. November 13, 2012. https://developer.android.com/ndk/downloads/revision_history. 
  20. "NDK Downloads | Android Developers" (in en). https://developer.android.com/ndk/downloads/index.html. 
  21. Srinivas, Davanum (December 9, 2007). "Android — Invoke JNI based methods (Bridging C/C++ and Java)". http://davanum.wordpress.com/2007/12/09/android-invoke-jni-based-methods-bridging-cc-and-java/. 
  22. "java.lang.System". Android Developers. http://developer.android.com/reference/java/lang/System.html. 
  23. "Android Debug Bridge (adb)". https://developer.android.com/studio/command-line/adb.html. 
  24. "Android NDK Native APIs | Android NDK". https://developer.android.com/ndk/guides/stable_apis. 
  25. "Using Eclipse for Android C/C++ Development". January 23, 2011. http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/. 
  26. "Using Visual Studio to Develop Native Android Code – VisualGDB Tutorials". https://visualgdb.com/tutorials/android/. 
  27. "Simpleperf | Android NDK". https://developer.android.com/ndk/guides/simpleperf. 
  28. "Android Developers guides". Developer.android.com. https://developer.android.com/guide. 
  29. Chen, Jason (May 12, 2008). "The Top 50 Applications". Android Developers Blog. http://android-developers.blogspot.com/2008/05/top-50-applications.html. 
  30. Brown, Eric (May 13, 2008). "Android Developer Challenge announces first-round winners". Linux for Devices. http://www.linuxdevices.com/news/NS3168326017.html. 
  31. "ADC I Top 50 Gallery". Android Developer Challenge. https://code.google.com/android/adc/adc_gallery/. 
  32. "Android Developer Challenge". Google Code. https://code.google.com/android/adc/. 
  33. Chu, Eric (October 6, 2009). "ADC 2 Round 1 Scoring Complete". Android Developers Blog. http://android-developers.blogspot.com/2009/10/adc-2-round-1-scoring-complete.html. 
  34. "ADC 2 Overall Winners". Android Developer Challenge. https://code.google.com/android/adc/gallery_winners.html. 
  35. Kharif, Olga (November 30, 2009). "Android Developer Challenge 2 Winners Announced". BusinessWeek. http://www.businessweek.com/the_thread/techbeat/archives/2009/11/android_develop_2.html. 
  36. "Dream android development". xda-developers forum. http://forum.xda-developers.com/forumdisplay.php?f=448. 
  37. "Rooting: Advantages and Disadvantages". ITCSE forum. http://unbrick.itcse.com/rooting-advantages-disadvantages/. 
  38. "Android 2.1 from Motorola Droid Ported to G1". Volt Mobile. March 10, 2010. http://voltmobileandtech.com/blog/. 
  39. Wimberly, Taylor (September 24, 2009). "CyanogenMod in trouble?". Android and me. http://androidandme.com/2009/09/hacks/cyanogenmod-in-trouble/. 
  40. Morrill, Dan (September 25, 2009). "A Note on Google Apps for Android". Android Developers Blog. http://android-developers.blogspot.com/2009/09/note-on-google-apps-for-android.html. 
  41. "The current state...". CyanogenMod Android ROM. September 27, 2009. http://www.cyanogenmod.com/home/the-current-state. 
  42. van Gurp, Jilles (November 13, 2007). "Google Android: Initial Impressions and Criticism". Javalobby. http://www.javalobby.org/nl/archive/jlnews_20071113o.html. "Frankly, I don't understand why Google intends to ignore the vast amount of existing implementation out there. It seems like a bad case of "not invented here" to me. Ultimately, this will slow adoption. There are already too many Java platforms for the mobile world and this is yet another one" 
  43. "Myriad's New J2Android Converter Fuels Android Applications Gold Rush". March 19, 2010. http://www.myriadgroup.com/Media-Centre/News/Myriad-New-J2Android-Converter-Fuels-Android-Applications-Gold-Rush.aspx. 
  44. Fruhlinger, Josh (2010-03-23). "J2Android hopes you don't know that Android is Java-based". JavaWorld. https://www.infoworld.com/article/2073306/j2android-hopes-you-don-t-know-that-android-is-java-based.html. "On the other hand, you might think this is kind of a scam aimed at developers who don't really understand the nature of the platform they're targeting. My biggest complaint is that you'd think that Mikael Ricknäs, the IDG News Service reporter who wrote the first story linked to above (who toils for the same company that publishes JavaWorld), would have at least mentioned the relationship between Java and Android to make the oddness of this announcement clear." 
  45. Fruhlinger, Josh (2010-03-31). "Myriad CTO: J2Android moves MIDlets to "beautiful" Android framework". JavaWorld. https://www.infoworld.com/article/2073324/myriad-cto--j2android-moves-midlets-to--beautiful--android-framework.html. "We will have to wait and see exactly how much pickup J2Android actually sees. The tool isn't actually available on the open market just yet; while Schillings spoke optimistically about "converting 1,000 MIDlets in an afternoon," at the moment they're working with a few providers to transform their back catalogs. So those of you out there hoping to avoid learning how to write Android code may have to wait a while." 
  46. Paul, Ryan (December 19, 2007). "Developing apps for Google Android: it's a mixed bag". Ars Technica. https://arstechnica.com/news.ars/post/20071219-google-android-plagued-by-dysfunctional-development-process.html. 
  47. Morrill, Dan (January 18, 2008). "You can't rush perfection, but now you can file bugs against it". Android Developers Blog. http://android-developers.blogspot.com/2008/01/you-cant-rush-perfection-but-now-you.html. 
  48. Morrison, Scott (December 19, 2007). "Glitches Bug Google's Android Software". The Wall Street Journal. https://www.wsj.com/articles/SB119800856883537515. 
  49. "Snake". Android Freeware Directory. http://www.android-freeware.org/download/snake. 
  50. "First Android Application — Snake". Mobiles2day. November 14, 2007. http://www.mobiles2day.com/2007/11/14/first-android-application-snake/. 
  51. Metz, Cade (July 14, 2008). "Google plays Hide and Seek with Android SDK". The Register. https://www.theregister.co.uk/2008/07/14/android_developer_unrest/. 
  52. "Android — An Open Handset Alliance Project: Upgrading the SDK". https://code.google.com/android/intro/upgrading.html. 
  53. "Other SDK Releases". Android Developers. http://developer.android.com/sdk/older_releases.html. 
  54. "SDK Archives". https://developer.android.com/sdk/older_releases. 
  55. "Google Play Hits 1 Million Apps". Mashable. July 24, 2013. http://mashable.com/2013/07/24/google-play-1-million/. 
  56. "Android App Stats". http://www.androlib.com/appstats.aspx. 
  57. Leena Rao (April 14, 2011). "Google: 3 Billion Android Apps Installed; Downloads Up 50 Percent From Last Quarter". Techcrunch. https://techcrunch.com/2011/04/14/google-3-billion-android-apps-installed-up-50-percent-from-last-quarter/. 
  58. "Developer Economics 2011". http://www.visionmobile.com/blog/2011/06/developer-economics-2011-winners-and-losers-in-the-platform-race/. 
  59. "Worldwide Smartphone Volumes Will Remain Down in 2018 Before Returning to Growth in 2019 and Beyond, According to IDC". idc.com. May 30, 2018. https://www.idc.com/getdoc.jsp?containerId=prUS43856818. 

Bibliography