title: Initializing Firebase in Modulair Android project written in kotlin gives not initialized error
body: <p>I'm having difficulty trying to implement firebase into an modulair android project written in kotlin. </p>
  
  <p>My structure looks like this: </p>
  
  <ul>
  <li>App
  
  <ul>
  <li>Feature</li>
  <li>Base</li>
  </ul></li>
  </ul>
  
  <p>And then in my main activity oncreate I'm calling the FirebaseApp.inialize(this)</p>
  
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    FirebaseApp.initializeApp(this)
    setContentView(R.layout.activity_main)
    spotifyAuthDataViewModel = ViewModelProviders.of(this)
      .get(SpotifyAuthDataViewModel::class.java)
  
    val liveData = spotifyAuthDataViewModel.getAuthData()
    info { liveData.value!!.spotifyToken }
  }
  </code></pre>
  
  <p>My viewmodel with livedata looks like this: </p>
  
  <pre><code>    class SpotifyAuthDataViewModel : ViewModel() {
    var authData: MutableLiveData&lt;SpotifyAuthData&gt; = MutableLiveData()
    private var mDatabase: DatabaseReference? = null
  
    fun getAuthData(): LiveData&lt;SpotifyAuthData&gt; {
      mDatabase = FirebaseDatabase.getInstance().reference
      FirebaseDatabase.getInstance()
            .getReference("/spotify_data")
            .addListenerForSingleValueEvent(object : ValueEventListener {
              override fun onCancelled(p0: DatabaseError?) {
              }
  
              override fun onDataChange(dataSnapshot: DataSnapshot) {
                if (dataSnapshot.exists()) {
                  var spotifyAuthData: SpotifyAuthData? =
                    dataSnapshot.getValue&lt;SpotifyAuthData&gt;(SpotifyAuthData::class.java)
                  authData.postValue(spotifyAuthData)
                }
              }
            }
            )
  
      return authData
  
    }
  }
  </code></pre>
  
  <p>But when i try to run the app i'm getting this message </p>
  
  <pre><code>  java.lang.RuntimeException: Unable to resume activity {com.jd.test.app/com.jd.test.feature.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.jd.test.app. Make sure to call FirebaseApp.initializeApp(Context) first.
  </code></pre>
  
  <p>I also tried creating an class extending my application and calling firebaseapp.initialize(this) and adding this to my manifest but i still got the same error.</p>
  
  <p>Manifest: </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.jd.test.feature"&gt;
        &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
        &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
    &lt;application android:name=".BaseApplication"&gt;
      &lt;activity android:name=".MainActivity"
          android:theme="@style/AppTheme"&gt;
        &lt;intent-filter android:order="1"&gt;
          &lt;action android:name="android.intent.action.VIEW"/&gt;
          &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
          &lt;category android:name="android.intent.category.DEFAULT"/&gt;
  
          &lt;data
              android:host=""
              android:pathPrefix="/.*"
              android:scheme="https"/&gt;
        &lt;/intent-filter&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN"/&gt;
  
          &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".spotify.views.SpotifyLogin"/&gt;
    &lt;/application&gt;
  
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>BaseApplication.kt:</p>
  
  <pre><code>class BaseApplication : Application() {
    override fun onCreate() {
      super.onCreate()
      FirebaseApp.initializeApp(this)
    }
  }
  </code></pre>
  
  <p>My feature gradle</p>
  
  <pre><code>    apply plugin: 'com.android.feature'
  
  apply plugin: 'kotlin-android'
  
  apply plugin: 'kotlin-android-extensions'
  
  apply plugin: 'kotlin-kapt'
  
  android {
    compileSdkVersion 27
    defaultConfig {
      minSdkVersion 23
      targetSdkVersion 27
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
      debug {
        useProguard false
        minifyEnabled false
      }
      release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
    }
  }
  
  repositories {
    flatDir {
      dirs 'libs'
    }
  }
  
  dependencies {
    def lifecycle_version = "1.1.0"
  
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'io.github.tonnyl:spark:0.1.0-alpha'
    implementation 'com.github.Joran-Dob:PlayPauseFab:0.0.3'
    implementation project(':base')
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation "com.squareup.retrofit2:retrofit:2.3.0"
    implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
    implementation "com.squareup.retrofit2:converter-gson:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
    implementation 'com.spotify.android:auth:1.1.0'
    implementation 'com.spotify.sdk:spotify-player-24-noconnect-2.20b@aar'
    implementation "org.jetbrains.anko:anko:0.10.5"
    implementation 'com.android.support:palette-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-database:15.0.1'
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    implementation "android.arch.lifecycle:viewmodel:$lifecycle_version" // use -ktx for Kotlin
    implementation "android.arch.lifecycle:livedata:$lifecycle_version"
    kapt "android.arch.lifecycle:compiler:$lifecycle_version"
    kapt 'com.github.bumptech.glide:compiler:4.4.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  }
  apply plugin: 'com.google.gms.google-services'
  </code></pre>