Reputation: 87
I'm trying to add firebase remote to config to the SDK which i'm developing but when I run the SDK in a app it says IllegalStateException
and throws this
"Default FirebaseApp is not initialized in this process com.example.xyz. Make sure to call FirebaseApp.initializeApp(Context) first."
Where as i'm calling FirebaseApp.initializeApp(context)
in the SDK. Can I know if anyone has implemented FirebaseRemoteConfig
in a SDK (i.e., .aar file).
Another error which is causing gradle from building the app :
Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension.
Here is my build.gradle file :
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.8.0'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
//Okhttp3
compile 'com.squareup.okhttp3:okhttp:3.6.0'
//Wakelock
compile 'com.commonsware.cwac:wakeful:1.1.0'
//Google Play Services
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
//Android Job
compile 'com.evernote:android-job:1.1.7'
//Firebase
compile 'com.google.firebase:firebase-config:11.0.1'
}
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 1
Views: 720
Reputation: 2198
You need to have a class in your sdk with at least one static method, e.g. MySdk.init(context)
which get a context as input and in this method, you call Firebaseapp.initializeApp(context)
. Also you have to ask the users of your sdk to call MySdk.init(context)
in the Application
class of their code or in their launcher activity
class.
Upvotes: 1