I have updated my application to the new firebase using the this and now when i compile my project i get the following exception.
Here is my logcat:
I solved by adding this and lowering the play-service dependancy to 8.4.0 compile 'com.google.android.gms:play-services:8.4.0'
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
MultiDex.install(this);
}
and add the following to the manifest
android:name="android.support.multidex.MultiDexApplication"
I think I've found a solution for this issue at this answer, please give it a look and thank @Gabriele Mariotti, he wrote:
In your top-level build.gradle you have to add:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Then in your module build.gradle:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Downgrade your dependency in build.gradle
file:
from:
compile 'com.google.android.gms:play-services:9.4.0'
to:
compile 'com.google.android.gms:play-services:7.3.0'
This worked in my case, hope same for you.
Step1: Fix multidex
Application class:
public class StudyNApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
}
}
Grade file
defaultConfig {
...
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Step2: Fix java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
Remove
compile 'com.google.android.gms:play-services:9.4.0'
Add two lib:
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
It worked fine.
Don't forget it.
android:name="android.support.multidex.MultiDexApplication"
This worked for me:
And then add the line compile 'com.android.support:multidex:1.0.1'
to your dependancies (or simply remove multiDexEnabled true
if not required)
Add this attribute to the application tag in manifest: android:name="android.support.multidex.MultiDexApplication"
If you already have a custom application class defined in Android Manifest, extend it from MultiDexApplication
instead of Application
Hope it helped!