SlideShare a Scribd company logo
1 of 26
Download to read offline
Building and Distributing
SDK Add-ons
Dave Smith
NewCircle, Inc.
@devunwired
+DaveSmithDev
–The Pointy Haired Boss
How do we connect developers with the
additional features and functionality we have
built into our Android-based device?
DISTRIBUTION VERSIONING
DOCUMENTATION VALIDATION
SDK Add-On
SDK Add-On
Library Package
Java stubs Java docs Meta
System Image Package
System Data Ramdisk Kernel Meta
SDK Repository
SDK Add-On
Library Package
Java stubs Java docs Meta
System Image Package
System Data Ramdisk Kernel Meta
Repo XML Meta
SDK Repository
SDK Add-On
Library Package
Java stubs Java docs Meta
System Image Package
System Data Ramdisk Kernel Meta
Repo XML Meta
SOLVED
Get The Tools!
$ repo init -u https://android.googlesource.com/platform/manifest 
-b android-5.0.1_r1 
-g all
$ repo sync
<manifest>

…

<project path="tools/adt/eclipse" name="platform/tools/adt/eclipse" groups="notdefault,tools" />

<project path="tools/adt/idea" name="platform/tools/adt/idea" groups="notdefault,tools" />

<project path="tools/base" name="platform/tools/base" groups="notdefault,tools" />

…

</manifest>
platform/manifest/default.xml
Android Shared Libraries
• Exposed from the /system/framework for use by applications.
• Applications reference via <uses-library> in the AndroidManifest.xml
• Library is appended to application's classpath
• No copy necessary in application's APK
• Exposed via XML definition in /system/etc/permissions
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.example.library1"
file="/system/framework/com.example.library1.jar"/>
</permissions>
/system/etc/permissions/com.example.library1.xml
Exposing Your Libs
# Build the library
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := com.example.library1
LOCAL_SRC_FILES := $(call all-java-files-under,.)
include $(BUILD_JAVA_LIBRARY)
# Copy XML to /system/etc/permissions/
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := com.example.library1.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
Android.mk
Documentation
• Javadoc parser wrapper
• Generated HTML from class/method comments
• Accessible to developers through the IDE
• Don't include in the system image packages list.
# Build the documentation
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-
subdir-html-files)
LOCAL_MODULE:= com.example.library1_doc
LOCAL_DROIDDOC_OPTIONS := com.example.library1
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
include $(BUILD_DROIDDOC)
Android.mk
Hook Into This…
…Developers Understand This
Inform SDK Manager
#Identify the component
name=SDK Add-On
name-id=addon
#Identify yourself
vendor=NewCircle
vendor-id=newcircle
#Identify the base target
api=21
#What did you add?
libraries=com.example.library1;com.example.library2
com.example.library1=com.example.library1.jar;Example Library
com.example.library2=com.example.library2.jar;Example Service
manifest.ini
Stubs!
SDK Package System Image
Internal Classes
Public ClassesPublic Classes
Stubs!
+com.example.library1.*
-com.example.library1.internal.*
+com.example.library2.*
-com.example.library2.internal.*
addon_stub_defs.txt
SDK Package System Image
Internal Classes
Public Classes
Public Classes
System Image Metadata
Addon.VendorDisplay=NewCircle
Addon.VendorId=newcircle
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
Pkg.Desc=NewCircle SDK Platform ${PLATFORM_VERSION}
Pkg.Revision=1
SystemImage.Abi=${TARGET_CPU_ABI}
#Link this image to your add-on via the tag
SystemImage.TagDisplay=SDK Add-On
SystemImage.TagId=addon
source.prop_template
PRODUCT_PACKAGES += …
PRODUCT_SDK_ADDON_NAME := device_sdk_addon
PRODUCT_SDK_ADDON_COPY_FILES := manifest.ini:manifest.ini
# Use this to copy your library modules
PRODUCT_SDK_ADDON_COPY_MODULES := 
com.example.library1:libs/com.example.library1.jar 
com.example.library2:libs/com.example.library2.jar
PRODUCT_SDK_ADDON_STUB_DEFS := addon_stub_defs.txt
# New on Lollipop+, system images are built as a separate package
PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP := source.prop_template
PRODUCT_SDK_ADDON_DOC_MODULES := com.example.library1_doc
# This add-on extends the default sdk product.
$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk)
PRODUCT_NAME := device_sdk_addon
PRODUCT_DEVICE := device
PRODUCT_MODEL := SDK Add-on For My Device
device_sdk_addon.mk
Add to Existing Target…
# Your existing product makefiles
PRODUCT_MAKEFILES := $(LOCAL_DIR)/full_device.mk
# Append your SDK add-on
PRODUCT_MAKEFILES += $(LOCAL_DIR)/device_sdk_addon.mk
AndroidProducts.mk
$ make PRODUCT-device_sdk_addon-sdk_addon
Repositories<sdk:sdk-sys-img xmlns:sdk="http://schemas.android.com/sdk/android/sys-img/3"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<sdk:license type="text" id="addon-license"> … </sdk:license>

<sdk:system-image>

<sdk:revision>1</sdk:revision>

<sdk:description>NewCircle SDK Platform 5.0.1</sdk:description>

<sdk:api-level>21</sdk:api-level>

<sdk:abi>x86</sdk:abi>

<sdk:archives>

<sdk:archive>

<sdk:size>187303276</sdk:size>

<sdk:checksum
type="sha1">33f9a1d41f16cb6f5b8099752131b8f01d5f53c3
</sdk:checksum>

<sdk:url>alpha_sdk_img_r1.zip</sdk:url>

</sdk:archive>

</sdk:archives>

<sdk:uses-license ref="addon-license"/>

<!-- Link this system image to our add-on library -->

<sdk:add-on>

<sdk:vendor-id>newcircle</sdk:vendor-id>

<sdk:vendor-display>NewCircle</sdk:vendor-display>

</sdk:add-on>

<sdk:tag-id>addon</sdk:tag-id>

</sdk:system-image>

</sdk:sdk-sys-img>
<?xml version="1.0" encoding="utf-8"?>

<sdk:sdk-addon xmlns:sdk="http://schemas.android.com/sdk/android/addon/7"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<sdk:license type="text" id="addon-license"> … </sdk:license>

<sdk:add-on>

<sdk:vendor-id>newcircle</sdk:vendor-id>

<sdk:vendor-display>NewCircle</sdk:vendor-display>

<sdk:name-id>addon</sdk:name-id>

<sdk:name-display>SDK Add-On</sdk:name-display>

<sdk:api-level>21</sdk:api-level>

<sdk:revision>1</sdk:revision>

<sdk:description>NewCircle SDK Add-On</sdk:description>

<sdk:desc-url>http://thenewcircle.com/</sdk:desc-url>

<sdk:uses-license ref="addon-license"/>

<sdk:archives>

<sdk:archive>

<sdk:size>104797</sdk:size>

<sdk:checksum
type="sha1">7418c038e40bdd82ebc8533183ab9404ad6860ec
</sdk:checksum>

<sdk:url>addon_r1.zip</sdk:url>

</sdk:archive>

</sdk:archives>

<!-- Note the extra libraries present in the add-on -->

<sdk:libs>

<sdk:lib>

<sdk:name>com.example.library1</sdk:name>

<sdk:description>Example Library</sdk:description>

</sdk:lib>

<sdk:lib>

<sdk:name>com.example.library2</sdk:name>

<sdk:description>Example Service</sdk:description>

</sdk:lib>

</sdk:libs>

</sdk:add-on>

</sdk:sdk-addon>
Tips & Tricks
• Archive SHA: sha1sum archive.zip | cut -d " " -f 1
• Archive Size: stat -c %s archive.zip
• Repository Schema Files
• $AOSP/prebuilts/devtools/repository/*.xsd
• xmllint --schema sdk-addon-07.xsd repository.xml
• Repository XML Generator Script
• $AOSP/development/build/tools/mk_sdk_repo_xml.sh
• Parses manifest.ini or source.properties for metadata
Learn More
Android Internals Public Class
Private On-Site Training Also Available
http://thenewcircle.com/training/android
Device Target + SDK Sample:
http://github.com/thenewcircle/alpha

More Related Content

What's hot

Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
Utkarsh Mankad
 
Android media codec 사용하기
Android media codec 사용하기Android media codec 사용하기
Android media codec 사용하기
Taehwan kwon
 
Fish classification by deepak rawal
Fish classification by deepak rawalFish classification by deepak rawal
Fish classification by deepak rawal
Dr Deepak Rawal
 

What's hot (15)

Important work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingualImportant work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingual
 
Android Audio System
Android Audio SystemAndroid Audio System
Android Audio System
 
Mollusca
MolluscaMollusca
Mollusca
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Aquatic habitat
Aquatic habitatAquatic habitat
Aquatic habitat
 
Camera2 API, SHIM, and HAL 3.2 in Android 5.1
Camera2 API, SHIM, and HAL 3.2 in Android 5.1Camera2 API, SHIM, and HAL 3.2 in Android 5.1
Camera2 API, SHIM, and HAL 3.2 in Android 5.1
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Fast Boot Times with InsydeH2O
Fast Boot Times with InsydeH2OFast Boot Times with InsydeH2O
Fast Boot Times with InsydeH2O
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Android media codec 사용하기
Android media codec 사용하기Android media codec 사용하기
Android media codec 사용하기
 
Collection and preservation of sponges and echinoderms
Collection and preservation of sponges and echinodermsCollection and preservation of sponges and echinoderms
Collection and preservation of sponges and echinoderms
 
Software update for IoT: the current state of play
Software update for IoT: the current state of playSoftware update for IoT: the current state of play
Software update for IoT: the current state of play
 
General Characteristics of Aschelminthes | Dr.BGR Publications
General Characteristics of Aschelminthes | Dr.BGR PublicationsGeneral Characteristics of Aschelminthes | Dr.BGR Publications
General Characteristics of Aschelminthes | Dr.BGR Publications
 
Draco volans
Draco volansDraco volans
Draco volans
 
Fish classification by deepak rawal
Fish classification by deepak rawalFish classification by deepak rawal
Fish classification by deepak rawal
 

Viewers also liked (6)

Mastering RecyclerView Layouts
Mastering RecyclerView LayoutsMastering RecyclerView Layouts
Mastering RecyclerView Layouts
 
ExtraLayoutSpace of RecyclerView
ExtraLayoutSpace of RecyclerViewExtraLayoutSpace of RecyclerView
ExtraLayoutSpace of RecyclerView
 
Master of RecyclerView
Master of RecyclerViewMaster of RecyclerView
Master of RecyclerView
 
The Tale of a Smooth RecyclerView
The Tale of a Smooth RecyclerViewThe Tale of a Smooth RecyclerView
The Tale of a Smooth RecyclerView
 
Recyclerview in action
Recyclerview in action Recyclerview in action
Recyclerview in action
 
[React Native Tutorial] Lecture 7: Navigation - Scene Transition - ListView
[React Native Tutorial] Lecture 7: Navigation - Scene Transition - ListView[React Native Tutorial] Lecture 7: Navigation - Scene Transition - ListView
[React Native Tutorial] Lecture 7: Navigation - Scene Transition - ListView
 

Similar to Build and Distributing SDK Add-Ons

Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta
10n Software, LLC
 

Similar to Build and Distributing SDK Add-Ons (20)

SFDX Presentation
SFDX PresentationSFDX Presentation
SFDX Presentation
 
MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...
MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...
MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...
 
Apache DeltaSpike: The CDI Toolbox
Apache DeltaSpike: The CDI ToolboxApache DeltaSpike: The CDI Toolbox
Apache DeltaSpike: The CDI Toolbox
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
 
Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with Backstage
 
Intro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler JewellIntro to Eclipse Che, by Tyler Jewell
Intro to Eclipse Che, by Tyler Jewell
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)
 
Accelerate Your Automation Testing Effort using TestProject & Docker | Docker...
Accelerate Your Automation Testing Effort using TestProject & Docker | Docker...Accelerate Your Automation Testing Effort using TestProject & Docker | Docker...
Accelerate Your Automation Testing Effort using TestProject & Docker | Docker...
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABC
 
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | EdurekaDevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
 
Understanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitUnderstanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profit
 
Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]
 
Light-up-your-out-of-the-box LightSwitch Application
Light-up-your-out-of-the-box LightSwitch ApplicationLight-up-your-out-of-the-box LightSwitch Application
Light-up-your-out-of-the-box LightSwitch Application
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
GradleFX
GradleFXGradleFX
GradleFX
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Build and Distributing SDK Add-Ons

  • 1. Building and Distributing SDK Add-ons Dave Smith NewCircle, Inc. @devunwired +DaveSmithDev
  • 2. –The Pointy Haired Boss How do we connect developers with the additional features and functionality we have built into our Android-based device?
  • 3.
  • 6. SDK Add-On Library Package Java stubs Java docs Meta System Image Package System Data Ramdisk Kernel Meta
  • 7. SDK Repository SDK Add-On Library Package Java stubs Java docs Meta System Image Package System Data Ramdisk Kernel Meta Repo XML Meta
  • 8. SDK Repository SDK Add-On Library Package Java stubs Java docs Meta System Image Package System Data Ramdisk Kernel Meta Repo XML Meta SOLVED
  • 9. Get The Tools! $ repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.1_r1 -g all $ repo sync <manifest>
 …
 <project path="tools/adt/eclipse" name="platform/tools/adt/eclipse" groups="notdefault,tools" />
 <project path="tools/adt/idea" name="platform/tools/adt/idea" groups="notdefault,tools" />
 <project path="tools/base" name="platform/tools/base" groups="notdefault,tools" />
 …
 </manifest> platform/manifest/default.xml
  • 10. Android Shared Libraries • Exposed from the /system/framework for use by applications. • Applications reference via <uses-library> in the AndroidManifest.xml • Library is appended to application's classpath • No copy necessary in application's APK • Exposed via XML definition in /system/etc/permissions <?xml version="1.0" encoding="utf-8"?> <permissions> <library name="com.example.library1" file="/system/framework/com.example.library1.jar"/> </permissions> /system/etc/permissions/com.example.library1.xml
  • 11. Exposing Your Libs # Build the library include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_MODULE := com.example.library1 LOCAL_SRC_FILES := $(call all-java-files-under,.) include $(BUILD_JAVA_LIBRARY) # Copy XML to /system/etc/permissions/ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_MODULE := com.example.library1.xml LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions LOCAL_SRC_FILES := $(LOCAL_MODULE) include $(BUILD_PREBUILT) Android.mk
  • 12. Documentation • Javadoc parser wrapper • Generated HTML from class/method comments • Accessible to developers through the IDE • Don't include in the system image packages list. # Build the documentation include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all- subdir-html-files) LOCAL_MODULE:= com.example.library1_doc LOCAL_DROIDDOC_OPTIONS := com.example.library1 LOCAL_MODULE_CLASS := JAVA_LIBRARIES LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true include $(BUILD_DROIDDOC) Android.mk
  • 14. Inform SDK Manager #Identify the component name=SDK Add-On name-id=addon #Identify yourself vendor=NewCircle vendor-id=newcircle #Identify the base target api=21 #What did you add? libraries=com.example.library1;com.example.library2 com.example.library1=com.example.library1.jar;Example Library com.example.library2=com.example.library2.jar;Example Service manifest.ini
  • 15. Stubs! SDK Package System Image Internal Classes Public ClassesPublic Classes
  • 17. System Image Metadata Addon.VendorDisplay=NewCircle Addon.VendorId=newcircle AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} Pkg.Desc=NewCircle SDK Platform ${PLATFORM_VERSION} Pkg.Revision=1 SystemImage.Abi=${TARGET_CPU_ABI} #Link this image to your add-on via the tag SystemImage.TagDisplay=SDK Add-On SystemImage.TagId=addon source.prop_template
  • 18. PRODUCT_PACKAGES += … PRODUCT_SDK_ADDON_NAME := device_sdk_addon PRODUCT_SDK_ADDON_COPY_FILES := manifest.ini:manifest.ini # Use this to copy your library modules PRODUCT_SDK_ADDON_COPY_MODULES := com.example.library1:libs/com.example.library1.jar com.example.library2:libs/com.example.library2.jar PRODUCT_SDK_ADDON_STUB_DEFS := addon_stub_defs.txt # New on Lollipop+, system images are built as a separate package PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP := source.prop_template PRODUCT_SDK_ADDON_DOC_MODULES := com.example.library1_doc # This add-on extends the default sdk product. $(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk) PRODUCT_NAME := device_sdk_addon PRODUCT_DEVICE := device PRODUCT_MODEL := SDK Add-on For My Device device_sdk_addon.mk
  • 19. Add to Existing Target… # Your existing product makefiles PRODUCT_MAKEFILES := $(LOCAL_DIR)/full_device.mk # Append your SDK add-on PRODUCT_MAKEFILES += $(LOCAL_DIR)/device_sdk_addon.mk AndroidProducts.mk
  • 21.
  • 22.
  • 23. Repositories<sdk:sdk-sys-img xmlns:sdk="http://schemas.android.com/sdk/android/sys-img/3"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <sdk:license type="text" id="addon-license"> … </sdk:license>
 <sdk:system-image>
 <sdk:revision>1</sdk:revision>
 <sdk:description>NewCircle SDK Platform 5.0.1</sdk:description>
 <sdk:api-level>21</sdk:api-level>
 <sdk:abi>x86</sdk:abi>
 <sdk:archives>
 <sdk:archive>
 <sdk:size>187303276</sdk:size>
 <sdk:checksum type="sha1">33f9a1d41f16cb6f5b8099752131b8f01d5f53c3 </sdk:checksum>
 <sdk:url>alpha_sdk_img_r1.zip</sdk:url>
 </sdk:archive>
 </sdk:archives>
 <sdk:uses-license ref="addon-license"/>
 <!-- Link this system image to our add-on library -->
 <sdk:add-on>
 <sdk:vendor-id>newcircle</sdk:vendor-id>
 <sdk:vendor-display>NewCircle</sdk:vendor-display>
 </sdk:add-on>
 <sdk:tag-id>addon</sdk:tag-id>
 </sdk:system-image>
 </sdk:sdk-sys-img>
  • 24. <?xml version="1.0" encoding="utf-8"?>
 <sdk:sdk-addon xmlns:sdk="http://schemas.android.com/sdk/android/addon/7"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <sdk:license type="text" id="addon-license"> … </sdk:license>
 <sdk:add-on>
 <sdk:vendor-id>newcircle</sdk:vendor-id>
 <sdk:vendor-display>NewCircle</sdk:vendor-display>
 <sdk:name-id>addon</sdk:name-id>
 <sdk:name-display>SDK Add-On</sdk:name-display>
 <sdk:api-level>21</sdk:api-level>
 <sdk:revision>1</sdk:revision>
 <sdk:description>NewCircle SDK Add-On</sdk:description>
 <sdk:desc-url>http://thenewcircle.com/</sdk:desc-url>
 <sdk:uses-license ref="addon-license"/>
 <sdk:archives>
 <sdk:archive>
 <sdk:size>104797</sdk:size>
 <sdk:checksum type="sha1">7418c038e40bdd82ebc8533183ab9404ad6860ec </sdk:checksum>
 <sdk:url>addon_r1.zip</sdk:url>
 </sdk:archive>
 </sdk:archives>
 <!-- Note the extra libraries present in the add-on -->
 <sdk:libs>
 <sdk:lib>
 <sdk:name>com.example.library1</sdk:name>
 <sdk:description>Example Library</sdk:description>
 </sdk:lib>
 <sdk:lib>
 <sdk:name>com.example.library2</sdk:name>
 <sdk:description>Example Service</sdk:description>
 </sdk:lib>
 </sdk:libs>
 </sdk:add-on>
 </sdk:sdk-addon>
  • 25. Tips & Tricks • Archive SHA: sha1sum archive.zip | cut -d " " -f 1 • Archive Size: stat -c %s archive.zip • Repository Schema Files • $AOSP/prebuilts/devtools/repository/*.xsd • xmllint --schema sdk-addon-07.xsd repository.xml • Repository XML Generator Script • $AOSP/development/build/tools/mk_sdk_repo_xml.sh • Parses manifest.ini or source.properties for metadata
  • 26. Learn More Android Internals Public Class Private On-Site Training Also Available http://thenewcircle.com/training/android Device Target + SDK Sample: http://github.com/thenewcircle/alpha