Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Dagger2AndBuildVariants
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
funnelbit
February 24, 2016
Technology
490
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dagger2AndBuildVariants
funnelbit
February 24, 2016
Transcript
26 slides
%BHHFS ͱ #VJME7BSJBOUT ଜɹྋ
ࣗݾհ w ଜɹྋ w ͯͳJEGVOOFMCJU w 5XJUUFSJEFYQFSPQFSP
None
ͯͳϒοΫϚʔΫ
%BHHFS #VJME7BSJBOUT
%BHHFS w IUUQHPPHMFHJUIVCJPEBHHFS w %*ίϯςφ w "15ͬͯίϯύΠϧ࣌ʹґଘղܾ
#VJME7BSJBOUT w #VJME5ZQFT 1SPEVDU'MBWPST
HSBEF productFlavors { typea { applicationId "com.funnelbit.testablediconceptapplication.typea" } typeb {
applicationId "com.funnelbit.testablediconceptapplication.typeb" } }
TSDNBJOKBWB TSDUZQFBKBWB TSDUZQFCKBWB
TSDNBJOKBWB
"QQ$PNQPOFOU#BTF public interface AppComponentBase { // App void inject(App app);
// Activity void inject(MainActivity mainActivity); }
"QJ$MJFOU public interface ApiClient { void request(String query, Callback callback);
class Response { public final String body; public Response(String body) { this.body = body; } } interface Callback { void onSuccess(Response response); void onFail(Exception e); } }
&OUSZ.BOBHFS public class EntryManager { final ApiClient mApiClient; @Inject EntryManager(ApiClient
apiClient) { mApiClient = apiClient; } public void create() { mApiClient.request("create query", new ApiClient.Callback() { … }); } public void delete() { mApiClient.request("delete query", new ApiClient.Callback() { … }); } }
.BJO"DUJWJUZ public class MainActivity extends AppCompatActivity { @Inject EntryManager mEntryManager;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((App) getApplication()).getAppComponent().inject(this); setContentView(R.layout.activity_main); mEntryManager.create(); mEntryManager.delete(); } }
TSDUZQFBKBWB
"QQ$PNQPOFOU @Component(modules = AppModule.class) public interface AppComponent extends AppComponentBase {
}
"QQ.PEVMF @Module public class AppModule { @Provides public ApiClient provideApiClient()
{ return new AppClientImpl(); } }
"QQ public class App extends Application { private AppComponent mAppComponent;
@Override public void onCreate() { super.onCreate(); mAppComponent = DaggerAppComponent.builder() .appModule(new AppModule()) .build(); } public AppComponent getAppComponent() { return mAppComponent; } }
"QQ$MJFOU*NQM public class AppClientImpl implements ApiClient { @Override public void
request(String query, Callback callback) { callback.onSuccess(new Response("production response")); } }
TSDUZQFCKBWB
"QQ$PNQPOFOU @Component(modules = {StubAppModule.class, DebugModule.class}) public interface AppComponent extends AppComponentBase
{ }
4UVC"QQ.PEVMF @Module public class StubAppModule { @Provides public ApiClient provideApiClient()
{ return new StubApiClient(); } }
"QQ public class App extends Application { private AppComponent mAppComponent;
@Inject LogUtil mLogUtil; @Override public void onCreate() { super.onCreate(); mAppComponent = DaggerAppComponent.builder() .stubAppModule(new StubAppModule()) .debugModule(new DebugModule()) .build(); mAppComponent.inject(this); mLogUtil.debugLog("͜Μʹͪ"); } public AppComponent getAppComponent() { return mAppComponent; } }
ߏ·ͱΊ w ڞ௨ͯ͠͏ͷNBJOʹ͔͘ w ৼΔ͍Λม͍͑ͨ߹*OKFDU w "QQNBJOʹஔ͔ͳ͍ w $PNQPOFOUNBJOͷ֎ w
.PEVMFNBJOҎ֎ͷ֎
·ͱΊ w ͕͍ͨ͠Ͱ͢ w ͲΜͳײ͡Ͱಋೖ͍ͯ͠Δ͔ w ςετͷ࣌Ͳ͏ͯ͠Δ͔
͋Γ͕ͱ͏͍͟͝·ͨ͠
More Decks by funnelbit
See All by funnelbit
Hatena Engineer Seminar #9
funnelbit
5
7.5k
droidkaigi-2017-renovation
funnelbit
10
11k
Dart
funnelbit
0
320
BottomBarAndSnackBar
funnelbit
0
560
Dagger2 Optional bindings
funnelbit
0
620
WearableRecyclerView
funnelbit
1
870
QucikSettingsTileAPI
funnelbit
0
390
Mobile Vision
funnelbit
0
500
AwarenessAPI
funnelbit
0
180
Other Decks in Technology
See All in Technology
全てを疑え!非自明な挙動と異常系から考える堅牢なカスタムコントローラ開発入門(CNDW2026)
lycorptech_jp
PRO
0
120
Claude Certified Developer – Professional 試験対策
shinoisa
0
290
メディアアートを〈拡張〉する——器官学と個体化論を手がかりに
_kotobuki_
1
400
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
230
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
4
1.1k
Metadata - Section 4 : MODS (Metadata Object Description Schema )
mohab1
0
180
ワークフローからハーネスへ — Web フレームワークの作者たちが AI エージェントに向かう理由
azukiazusa1
4
3.6k
Taking back control of your AI development
inesmontani
PRO
0
320
AWS Well-Arhitected Frameworkセキュリティの柱 について
miu_crescent
PRO
2
270
本の挿絵に困ったから挿絵メーカーを自作した
yoshimura_datam
1
130
フルTypeScript × AI駆動開発で開発量が数倍に (JSConf JP 2026 スポンサーLT:NCDC株式会社)
keitaibaraki
0
610
Terraform 0 to 100:100個以上のリポジトリを常に最新にし続けるための自動化
sue445
3
1.5k
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.7k
Producing Creativity
orderedlist
PRO
348
41k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
The Cult of Friendly URLs
andyhume
79
7.1k
Speed Design
sergeychernyshev
33
2.3k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.3k