SlideShare a Scribd company logo
Make it compatible
Keishin Yokomaku (KeithYokoma) @ Drivemode, Inc.
Shibuya Apk #2
Profile
• Keishin Yokomaku at Drivemode, Inc.
• Social: @KeithYokoma
• Publication: Android Training
• Product:
• Like: Bicycle, Photography, Tumblr
• Nickname: Qiita Meister
Compatibility
Compatibility
• between Android versions
• between phone models
Make it compatible with
Android versions
Android versions
1. SDK versions
2. Compatibility mode
3. Annotations and branching by if-statement
4. Build compatibility classes
5. Branching object with Dagger
**SdkVersion
• minSdkVersion
• Application will support this version at least.
• targetSdkVersion
• Application is fine on this version.
• maxSdkVersion
• Not recommended to specify
• If specified and system is updated to above the version, the
application will automatically uninstalled.
targetSdkVersion
• Compatibility mode
• If targetSdkVersion is set ’10’
• Application behaves as API Level 10 even if it is running on 22.
Call requires…
• You likely to see this message…
‘if’
public void doSomething() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// for Lollipop
} else {
// for Kitkat and below
}
}
Call requires…
• Still you see this warning…
Which is preferred?
• 2 Annotations
• @SuppressLint(“NewApi”)
• @TargetApi(Build.VERSION_CODES.LOLLIPOP)
Which is preferred?
• @SuppressLint(“NewApi”)
• Suppress all warnings of “NewApi”
• Even if someone call newer API later on, no lint warnings appear
• @TargetApi(Build.VERSION_CODES.LOLLIPOP)
• Recommended
• Suppress warning up to specified API Level
• If someone call newer API later on, new lint warning appears
Branching, branching, branching…
public class Something {
public void foo() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// foo on Lollipop
} else {
// foo on pre-Lollipop
}
}
public void bar() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// bar on Lollipop
} else {
// bar on pre-Lollipop
}
}
// …
}
Looks Not Good To Me
Learn from Android
AOSP style delegate pattern
• Declare each classes corresponding to support version
• Enclose those classes in the service class
• Delegate all methods to enclosed object
• Basic architecture on Support Library
AOSP style delegate pattern
public class SomethingCompat {
private final SomethingImpl mImpl; // initialize in ctor
public void doSomething() {
mImpl.doSomething();
}
private interface SomethingImpl {
void doSomething();
}
private static class SomethingICS implements SomethingImpl {
@Override
public void doSomething() {}
}
private static class SomethingJB implements SomethingImpl {
@Override
public void doSomething() {}
}
}
AOSP style delegate pattern
public class SomethingCompat {
private final SomethingImpl mImpl; // initialize in ctor
public SomethingCompat() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mImpl = new SomethingJB();
} else if (Build.Version.SDK_INT >=
Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mImpl = new SomethingICS();
} else {
mImpl = new SomethingDefault();
}
}
}
AOSP style delegate pattern
• Pros
• Clean code
• More testable, more flexible
• Cons
• Hard to test for each enclosed classes
• Sometimes they don’t put any codes for compatibility
public void doSomething() {
// TODO compatibility implementation
}
public Object returnSomething() {
return null;
}
Service object depends on delegate object
• What if using dependency injection?
• Inject object in constructor
➡ Configure injected object outside of service object
➡ Easily configure test condition
Android versions
• Inject different objects by version with Dagger
• Declare common interface
• Implement it enclosing API level specific processes
• Configure modules which implementation to be injected
SomethingImpl something
SomethingICS implements ISomethingImpl
SomethingJB implements ISomethingImpl
SomethingL implements ISomethingImpl
Module
{
Package
• Package structure
❖ com.example.model
• SomethingService (or SomethingProvider, SomethingCompat)
❖ impl
• SomethingImpl
• SomethingICS
• SomethingJB
• SomethingL
Make it compatible with
Android models
アッハイ
Model and manufacturers
• S*msung
• Galaxy
• L*
• G
• Optimus
• S*ny Ericsson
• Xperia
• F*jitsu
• Arrows
★☆☆☆☆
“Doesn’t work on my device! It keeps crashing!!”
No way!
How to deal with it
1. No clue to predict problems specific to some device
2. Detect problems as early as possible
3. Use workaround utility and enclose dirty works in it
Test! test! test!
• Remote Testing Services
• PerfectoMobile
• Remote TestKit
• Samsung Test Lab
• Cloud Test Lab
• Smartphone Test Farm
Make it quicker to notice errors
• Crash reports
• Crashlytics
• BugSense
• ACRA(Application Crash Reports for Android)
• Integrate reports to
• Email
• Chat(Slack, HipChat, ChatWork…)
Encapsulate compatibility code
• Good to go with DI
• like version compatibility architecture
• AndroidDeviceCompatibility
• https://github.com/mixi-inc/Android-Device-Compatibility
• History from API 7
Still it doesn’t work?
Problems
• Framework has bugs in
• Java layer
• Various type of bugs and result will be…
➡ Some of ‘RuntimeException’ or some of ‘Error’ causes crash
• native code layer
• Bad lib** implementation
• Bad memory management
• Result
➡ Process will be killed and no crash dialog
Problems
• Some of ‘RuntimeException’
• Unexpectedly access `null` (NullPointerException)
• Something is wrong (RuntimeException, IllegalStateException…)
• Some of ‘Error’
• Class path conflict (VerifyError)
• Unknown method definition on interface (AbstractMethodError)
★☆☆☆☆
“Doesn’t work for me. No crash though…”
–Johnny Appleseed
“ここに引用を入力してください。”
(Photo by SAKURAKO - Do not get mad !/ MJ/TR (´・ω・))
Big unknowns a lot, a lot, a lot…
• (╯°□°)╯︵ ┻━┻
• Collect logs from area that seems to have some bug
• Collect everything you need to debug…
• View properties, object state, etc…
• stackoverflow.com
Be quick, be hacker
• No solid solution. Just you need to be quick to get info.
• If you get the device causing issue, let’s hack it!
Make it compatible
Keishin Yokomaku (KeithYokoma) @ Drivemode, Inc.
Shibuya Apk #2

More Related Content

What's hot

Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014
Emanuele Rampichini
 
Make sure your code works
Make sure your code worksMake sure your code works
Make sure your code worksHenrik Skupin
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
Lyudmil Latinov
 
Android talks #08 dagger2
Android talks #08   dagger2Android talks #08   dagger2
Android talks #08 dagger2
Infinum
 
Building the Test Automation Framework - Jenkins for Testers
Building the Test Automation Framework - Jenkins for TestersBuilding the Test Automation Framework - Jenkins for Testers
Building the Test Automation Framework - Jenkins for Testers
William Echlin
 
Cypress workshop for JSFoo 2019
Cypress  workshop for JSFoo 2019Cypress  workshop for JSFoo 2019
Cypress workshop for JSFoo 2019
Biswajit Pattanayak
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
Kushan Shalindra Amarasiri - Technical QE Specialist
 
Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)
Ford Prior
 
TDD on OSGi, in practice.
TDD on OSGi, in practice.TDD on OSGi, in practice.
TDD on OSGi, in practice.
Elian, I.
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
Marakana Inc.
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
Hazem Saleh
 
Rails automatic test driven development
Rails automatic test driven developmentRails automatic test driven development
Rails automatic test driven development
tyler4long
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
Hazem Saleh
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
Hannes Lowette
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
Eric Wendelin
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Sauce Labs
 
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
Test Girls
 

What's hot (20)

Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014
 
Make sure your code works
Make sure your code worksMake sure your code works
Make sure your code works
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
 
Android talks #08 dagger2
Android talks #08   dagger2Android talks #08   dagger2
Android talks #08 dagger2
 
Building the Test Automation Framework - Jenkins for Testers
Building the Test Automation Framework - Jenkins for TestersBuilding the Test Automation Framework - Jenkins for Testers
Building the Test Automation Framework - Jenkins for Testers
 
Cypress workshop for JSFoo 2019
Cypress  workshop for JSFoo 2019Cypress  workshop for JSFoo 2019
Cypress workshop for JSFoo 2019
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
 
Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)Testing API's: Tools & Tips & Tricks (Oh My!)
Testing API's: Tools & Tips & Tricks (Oh My!)
 
TDD on OSGi, in practice.
TDD on OSGi, in practice.TDD on OSGi, in practice.
TDD on OSGi, in practice.
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
 
Rails automatic test driven development
Rails automatic test driven developmentRails automatic test driven development
Rails automatic test driven development
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
 
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
 

Viewers also liked

API Design
API DesignAPI Design
API Design
Tim Boudreau
 
What java developers (don’t) know about api compatibility
What java developers (don’t) know about api compatibilityWhat java developers (don’t) know about api compatibility
What java developers (don’t) know about api compatibility
Jens Dietrich
 
Relatividade moysés
Relatividade moysésRelatividade moysés
Relatividade moysés
A'nderé Freire
 
How to keep your child safe on holiday
How to keep your child safe on holidayHow to keep your child safe on holiday
How to keep your child safe on holiday
Amb Steve Mbugua
 
Extrafiles file 13 sweden
Extrafiles file 13 swedenExtrafiles file 13 sweden
Extrafiles file 13 sweden
Douglas Millar
 
Falah Dinullah
Falah DinullahFalah Dinullah
Falah Dinullah
Faldin59
 
Web+proxy Posts - Page 1
Web+proxy Posts - Page 1Web+proxy Posts - Page 1
Web+proxy Posts - Page 1
scientificcuff635
 
Журнал "Культурологічні джерела". №2. 2015 рік.
Журнал "Культурологічні джерела". №2. 2015 рік.Журнал "Культурологічні джерела". №2. 2015 рік.
Журнал "Культурологічні джерела". №2. 2015 рік.
oomckuzh
 
Inform.
Inform.Inform.
Top 15 Weight Loss Diet Foods
Top 15 Weight Loss Diet FoodsTop 15 Weight Loss Diet Foods
Top 15 Weight Loss Diet Foods
Ironbuttz43
 
eCQM Certification Subgroup Slides July 28 2015
eCQM Certification Subgroup Slides July 28 2015eCQM Certification Subgroup Slides July 28 2015
eCQM Certification Subgroup Slides July 28 2015
dczulada
 
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee YogyakartaPengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
Wayan Ordiyasa UNRIYO
 

Viewers also liked (16)

API Design
API DesignAPI Design
API Design
 
What java developers (don’t) know about api compatibility
What java developers (don’t) know about api compatibilityWhat java developers (don’t) know about api compatibility
What java developers (don’t) know about api compatibility
 
Relatividade moysés
Relatividade moysésRelatividade moysés
Relatividade moysés
 
Bencana11
Bencana11Bencana11
Bencana11
 
How to keep your child safe on holiday
How to keep your child safe on holidayHow to keep your child safe on holiday
How to keep your child safe on holiday
 
report
reportreport
report
 
Extrafiles file 13 sweden
Extrafiles file 13 swedenExtrafiles file 13 sweden
Extrafiles file 13 sweden
 
Falah Dinullah
Falah DinullahFalah Dinullah
Falah Dinullah
 
Web+proxy Posts - Page 1
Web+proxy Posts - Page 1Web+proxy Posts - Page 1
Web+proxy Posts - Page 1
 
Журнал "Культурологічні джерела". №2. 2015 рік.
Журнал "Культурологічні джерела". №2. 2015 рік.Журнал "Культурологічні джерела". №2. 2015 рік.
Журнал "Культурологічні джерела". №2. 2015 рік.
 
Inform.
Inform.Inform.
Inform.
 
Top 15 Weight Loss Diet Foods
Top 15 Weight Loss Diet FoodsTop 15 Weight Loss Diet Foods
Top 15 Weight Loss Diet Foods
 
eCQM Certification Subgroup Slides July 28 2015
eCQM Certification Subgroup Slides July 28 2015eCQM Certification Subgroup Slides July 28 2015
eCQM Certification Subgroup Slides July 28 2015
 
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee YogyakartaPengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
Pengaruh Kualitas Pelayanan Terhadap Minat Konsumen di Goeboex Cofee Yogyakarta
 
Pr 1-examples
Pr 1-examplesPr 1-examples
Pr 1-examples
 
CV BIGATI B.Paulin,
CV BIGATI B.Paulin,CV BIGATI B.Paulin,
CV BIGATI B.Paulin,
 

Similar to Make it compatible

Building Top-Notch Androids SDKs
Building Top-Notch Androids SDKsBuilding Top-Notch Androids SDKs
Building Top-Notch Androids SDKs
relayr
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
Positive Hack Days
 
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan KustAndroid Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
Infinum
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross IntroductionStuart Lodge
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
Xamarin
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conference
Christopher Miller
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
Cavelle Benjamin
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
Niels Frydenholm
 
JBCN_Testing_With_Containers
JBCN_Testing_With_ContainersJBCN_Testing_With_Containers
JBCN_Testing_With_Containers
Grace Jansen
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform development
Gill Cleeren
 
JLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containersJLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containers
Grace Jansen
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application Security
Egor Tolstoy
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
Michael Vorburger
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Eugene Kurko
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
UA Mobile
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
Swain Loda
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
Ortus Solutions, Corp
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator Titanium
Techday7
 

Similar to Make it compatible (20)

Building Top-Notch Androids SDKs
Building Top-Notch Androids SDKsBuilding Top-Notch Androids SDKs
Building Top-Notch Androids SDKs
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
 
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan KustAndroid Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
Android Meetup Slovenija #3 - Testing with Robolectric by Ivan Kust
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross Introduction
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conference
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
JBCN_Testing_With_Containers
JBCN_Testing_With_ContainersJBCN_Testing_With_Containers
JBCN_Testing_With_Containers
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform development
 
JLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containersJLove - Replicating production on your laptop using the magic of containers
JLove - Replicating production on your laptop using the magic of containers
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application Security
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator Titanium
 

More from Keishin Yokomaku

UI optimization for night
UI optimization for nightUI optimization for night
UI optimization for night
Keishin Yokomaku
 
Popup view on Mortar
Popup view on MortarPopup view on Mortar
Popup view on Mortar
Keishin Yokomaku
 
Regexp in Android and Java
Regexp in Android and JavaRegexp in Android and Java
Regexp in Android and Java
Keishin Yokomaku
 
Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
Keishin Yokomaku
 
Signature
SignatureSignature
Signature
Keishin Yokomaku
 
Android Media Hacks
Android Media HacksAndroid Media Hacks
Android Media Hacks
Keishin Yokomaku
 
Null, the Abyss
Null, the AbyssNull, the Abyss
Null, the Abyss
Keishin Yokomaku
 
?
??
Building stable and flexible libraries
Building stable and flexible librariesBuilding stable and flexible libraries
Building stable and flexible libraries
Keishin Yokomaku
 
Typeface
TypefaceTypeface
Version Management
Version ManagementVersion Management
Version Management
Keishin Yokomaku
 
イカしたライブラリを作った話
イカしたライブラリを作った話イカしたライブラリを作った話
イカしたライブラリを作った話
Keishin Yokomaku
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と Gradle
Keishin Yokomaku
 
自己組織化
自己組織化自己組織化
自己組織化
Keishin Yokomaku
 

More from Keishin Yokomaku (14)

UI optimization for night
UI optimization for nightUI optimization for night
UI optimization for night
 
Popup view on Mortar
Popup view on MortarPopup view on Mortar
Popup view on Mortar
 
Regexp in Android and Java
Regexp in Android and JavaRegexp in Android and Java
Regexp in Android and Java
 
Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
 
Signature
SignatureSignature
Signature
 
Android Media Hacks
Android Media HacksAndroid Media Hacks
Android Media Hacks
 
Null, the Abyss
Null, the AbyssNull, the Abyss
Null, the Abyss
 
?
??
?
 
Building stable and flexible libraries
Building stable and flexible librariesBuilding stable and flexible libraries
Building stable and flexible libraries
 
Typeface
TypefaceTypeface
Typeface
 
Version Management
Version ManagementVersion Management
Version Management
 
イカしたライブラリを作った話
イカしたライブラリを作った話イカしたライブラリを作った話
イカしたライブラリを作った話
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と Gradle
 
自己組織化
自己組織化自己組織化
自己組織化
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

Make it compatible

  • 1. Make it compatible Keishin Yokomaku (KeithYokoma) @ Drivemode, Inc. Shibuya Apk #2
  • 2. Profile • Keishin Yokomaku at Drivemode, Inc. • Social: @KeithYokoma • Publication: Android Training • Product: • Like: Bicycle, Photography, Tumblr • Nickname: Qiita Meister
  • 3.
  • 5. Compatibility • between Android versions • between phone models
  • 6. Make it compatible with Android versions
  • 7. Android versions 1. SDK versions 2. Compatibility mode 3. Annotations and branching by if-statement 4. Build compatibility classes 5. Branching object with Dagger
  • 8. **SdkVersion • minSdkVersion • Application will support this version at least. • targetSdkVersion • Application is fine on this version. • maxSdkVersion • Not recommended to specify • If specified and system is updated to above the version, the application will automatically uninstalled.
  • 9. targetSdkVersion • Compatibility mode • If targetSdkVersion is set ’10’ • Application behaves as API Level 10 even if it is running on 22.
  • 10. Call requires… • You likely to see this message…
  • 11. ‘if’ public void doSomething() { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { // for Lollipop } else { // for Kitkat and below } }
  • 12. Call requires… • Still you see this warning…
  • 13. Which is preferred? • 2 Annotations • @SuppressLint(“NewApi”) • @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  • 14. Which is preferred? • @SuppressLint(“NewApi”) • Suppress all warnings of “NewApi” • Even if someone call newer API later on, no lint warnings appear • @TargetApi(Build.VERSION_CODES.LOLLIPOP) • Recommended • Suppress warning up to specified API Level • If someone call newer API later on, new lint warning appears
  • 15. Branching, branching, branching… public class Something { public void foo() { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { // foo on Lollipop } else { // foo on pre-Lollipop } } public void bar() { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { // bar on Lollipop } else { // bar on pre-Lollipop } } // … }
  • 16. Looks Not Good To Me
  • 18. AOSP style delegate pattern • Declare each classes corresponding to support version • Enclose those classes in the service class • Delegate all methods to enclosed object • Basic architecture on Support Library
  • 19. AOSP style delegate pattern public class SomethingCompat { private final SomethingImpl mImpl; // initialize in ctor public void doSomething() { mImpl.doSomething(); } private interface SomethingImpl { void doSomething(); } private static class SomethingICS implements SomethingImpl { @Override public void doSomething() {} } private static class SomethingJB implements SomethingImpl { @Override public void doSomething() {} } }
  • 20. AOSP style delegate pattern public class SomethingCompat { private final SomethingImpl mImpl; // initialize in ctor public SomethingCompat() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mImpl = new SomethingJB(); } else if (Build.Version.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { mImpl = new SomethingICS(); } else { mImpl = new SomethingDefault(); } } }
  • 21. AOSP style delegate pattern • Pros • Clean code • More testable, more flexible • Cons • Hard to test for each enclosed classes • Sometimes they don’t put any codes for compatibility public void doSomething() { // TODO compatibility implementation } public Object returnSomething() { return null; }
  • 22. Service object depends on delegate object • What if using dependency injection? • Inject object in constructor ➡ Configure injected object outside of service object ➡ Easily configure test condition
  • 23. Android versions • Inject different objects by version with Dagger • Declare common interface • Implement it enclosing API level specific processes • Configure modules which implementation to be injected SomethingImpl something SomethingICS implements ISomethingImpl SomethingJB implements ISomethingImpl SomethingL implements ISomethingImpl Module {
  • 24. Package • Package structure ❖ com.example.model • SomethingService (or SomethingProvider, SomethingCompat) ❖ impl • SomethingImpl • SomethingICS • SomethingJB • SomethingL
  • 25. Make it compatible with Android models
  • 26.
  • 28. Model and manufacturers • S*msung • Galaxy • L* • G • Optimus • S*ny Ericsson • Xperia • F*jitsu • Arrows
  • 29. ★☆☆☆☆ “Doesn’t work on my device! It keeps crashing!!”
  • 31. How to deal with it 1. No clue to predict problems specific to some device 2. Detect problems as early as possible 3. Use workaround utility and enclose dirty works in it
  • 32. Test! test! test! • Remote Testing Services • PerfectoMobile • Remote TestKit • Samsung Test Lab • Cloud Test Lab • Smartphone Test Farm
  • 33. Make it quicker to notice errors • Crash reports • Crashlytics • BugSense • ACRA(Application Crash Reports for Android) • Integrate reports to • Email • Chat(Slack, HipChat, ChatWork…)
  • 34. Encapsulate compatibility code • Good to go with DI • like version compatibility architecture • AndroidDeviceCompatibility • https://github.com/mixi-inc/Android-Device-Compatibility • History from API 7
  • 36. Problems • Framework has bugs in • Java layer • Various type of bugs and result will be… ➡ Some of ‘RuntimeException’ or some of ‘Error’ causes crash • native code layer • Bad lib** implementation • Bad memory management • Result ➡ Process will be killed and no crash dialog
  • 37. Problems • Some of ‘RuntimeException’ • Unexpectedly access `null` (NullPointerException) • Something is wrong (RuntimeException, IllegalStateException…) • Some of ‘Error’ • Class path conflict (VerifyError) • Unknown method definition on interface (AbstractMethodError)
  • 38. ★☆☆☆☆ “Doesn’t work for me. No crash though…”
  • 40. Big unknowns a lot, a lot, a lot… • (╯°□°)╯︵ ┻━┻ • Collect logs from area that seems to have some bug • Collect everything you need to debug… • View properties, object state, etc… • stackoverflow.com
  • 41. Be quick, be hacker • No solid solution. Just you need to be quick to get info. • If you get the device causing issue, let’s hack it!
  • 42. Make it compatible Keishin Yokomaku (KeithYokoma) @ Drivemode, Inc. Shibuya Apk #2