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:
11:57:54.533 27844-27844/com.example.dayshift_2.traveyy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.dayshift_2.traveyy, PID: 27844
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4871)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4466)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4406)
at android.app.ActivityThread.access$1500(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
My Build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.dayshift_2.traveyy"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.roughike:bottom-bar:1.2.1'
}
apply plugin: 'com.google.gms.google-services'
Not sure where i am getting this exception from. any help will be highly appreciated. Thank you
I was facing the same error when I incremented the targetSDKVersion from 22 to 23 I spent minimum a whole day to resolve the issue. Now finally i find the result that use different play service api in your build.gradle file Source: https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project
I added only relevant Api's and my app is working fine.
Don't forget it.
apply plugin:
'com.google.gms.google-services'
.I downgraded my google play-service dependency from
to
which solved this issue for me.
Please refer to the following Stack Overflow link for further description.
Please Note: On upgrading to the latest google play-service
compile 'com.google.android.gms:play-services:9.4.0'
it solved this issue as well.Or you could selectively import certain services that you require, instead of importing all google play services.
Configure your app for multidex to resolve this issue.
Modify the
module-level build.gradle
and add the multidex library as a dependency, as shown below:android { defaultConfig { ... minSdkVersion 15 targetSdkVersion 26 multiDexEnabled true } //... } dependencies { compile 'com.android.support:multidex:1.0.1' }
If you do not override the
Application
class, edit yourmanifest
file to setandroid:name
in the application tag as follows<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapp"> <application android:name="android.support.multidex.MultiDexApplication"> //... </application> </manifest>
2.1.1. If you do override the
Application
class ExtendMultiDexApplication
2.1.2. Or if you do override the
Application
class but it's not possible to change the base class, then you can instead override theattachBaseContext()
method and call MultiDex.install(this) to enable multidex:public class MyApplication extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }
for more mdex-gradle
Hope this will be help others who are facing same issue.
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'
and add the following to the manifest