별건 없고 DaggerApplication 를 상속해서 App 클래스를 생성하려고 하는데 Multidex 가 필요한 경우 어떻게 해야 하나 하고 잠시 고민 중에
MultiDexApplication 이 어떻게 구현되어 있나 봤더니 심.플.했.다.
public class MultiDexApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
고로 아래와 같이 구현해주었더니 끝!
class MainApp : DaggerApplication() {
private val component: AndroidInjector<MainApp> by lazy {
DaggerAppComponent.factory().create(this)
}
override fun applicationInjector() =
component
override fun onCreate() {
super.onCreate()
// TODO
}
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}
}
MultiDexApplication 이 어떻게 구현되어 있나 봤더니 심.플.했.다.
public class MultiDexApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
고로 아래와 같이 구현해주었더니 끝!
class MainApp : DaggerApplication() {
private val component: AndroidInjector<MainApp> by lazy {
DaggerAppComponent.factory().create(this)
}
override fun applicationInjector() =
component
override fun onCreate() {
super.onCreate()
// TODO
}
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}
}
'Android' 카테고리의 다른 글
오류 Kotlin: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option (0) | 2019.09.10 |
---|---|
OnBackPressedDispatcher 이용 (0) | 2019.09.05 |
navigation navigate 를 layout xml 에서 처리 하기 (0) | 2019.09.03 |
BuildConfig 내 APPLICATION_ID Deprecated 됨 (0) | 2019.08.23 |
viewmodel 에서 lifecycle 관리 (0) | 2019.08.23 |