// all previously added play-services has version 11.8.0
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
// newly added gradle library to add the firebase to app
implementation 'com.google.firebase:firebase-core:16.0.0'As I come accross below error after adding firebse to my app.
Compilation failed; see the compiler error output for details.
error: cannot access zzbfmclass file for
com.google.android.gms.internal.zzbfm not found
As you can see above that version of firebase-core gradle is 16.0.0, is different
from the other gms:play services (version 11.8.0).Latest Individual Google Play Services APIs and corresponding build.gradle descriptions:
https://developers.google.com/android/guides/setup
Firebase Android Release Notes: Latest SDK versions Service - Gradle dependency:
https://firebase.google.com/support/release-notes/android
or you can also change the all library/dependency versions to same (or latest--not
tested by me ref issue: mixing libraries from old and new Firebase release and
other link: Class file for com.google.android.gms.internal.zzaja not found ).
So, I changed to firebase-core to version 11.8.0
// all previously added play-services has version 11.8.0 implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
// newly added gradle to add the firebase to app
implementation 'com.google.firebase:firebase-core:11.8.0'
with my latest project with targetSdkVersion 28, below gradles working fine:
// firebase dependencies
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
implementation 'com.google.firebase:firebase-appindexing:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
//gms play services
implementation 'com.google.android.gms:play-services-ads-lite:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
Also using the following google play services plugin in the top (Project) level build.gradle file:
classpath 'com.google.gms:google-services:4.2.0'
Useful Reference: https://stackoverflow.com/questions/51381727/android-cannot-add-all-google-libraries-for-version-15-0-1/51381916#51381916
Find Below App and Project level build.gradle file
(Module: app) level build.gradle file with com.google.firebase and android.gms:play-services dependencies :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
}
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example_app"
// API Level: 17 Android 4.2 (JELLY_BEAN_MR1)
minSdkVersion 17
//Android 4.1 (JELLY_BEAN) 16
// minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
// put below code to increase stack size of the thread,
// aslo remove comment from build.properties org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
testOptions {
unitTests.all {
jvmArgs '-XX:MaxPermSize=1024m' //prevent OOM (PermGen space) while running tests
}
}
dexOptions {
javaMaxHeapSize "4g"
// incremental true
}
aaptOptions {
cruncherEnabled false
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
debuggable false
}
debug {
debuggable true
jniDebuggable true
renderscriptDebuggable true
minifyEnabled false
zipAlignEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// firebase dependencies
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5' //
implementation 'com.google.firebase:firebase-appindexing:16.0.2' //
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
//gms play services
implementation 'com.google.android.gms:play-services-ads-lite:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// support libraries android
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.mediarouter:mediarouter:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
//other library gradle
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.j256.ormlite:ormlite-android:4.46'
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
//calligraphy
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
//glide dependency
implementation 'com.github.bumptech.glide:glide:4.10.0'
kapt 'com.github.bumptech.glide:compiler:4.10.0'
//butterknife dependency
implementation 'com.jakewharton:butterknife:10.1.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
}
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example_app"
// API Level: 17 Android 4.2 (JELLY_BEAN_MR1)
minSdkVersion 17
//Android 4.1 (JELLY_BEAN) 16
// minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
// put below code to increase stack size of the thread,
// aslo remove comment from build.properties org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
testOptions {
unitTests.all {
jvmArgs '-XX:MaxPermSize=1024m' //prevent OOM (PermGen space) while running tests
}
}
dexOptions {
javaMaxHeapSize "4g"
// incremental true
}
aaptOptions {
cruncherEnabled false
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
debuggable false
}
debug {
debuggable true
jniDebuggable true
renderscriptDebuggable true
minifyEnabled false
zipAlignEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// firebase dependencies
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5' //
implementation 'com.google.firebase:firebase-appindexing:16.0.2' //
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
//gms play services
implementation 'com.google.android.gms:play-services-ads-lite:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// support libraries android
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.mediarouter:mediarouter:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
//other library gradle
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.j256.ormlite:ormlite-android:4.46'
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
//calligraphy
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
//glide dependency
implementation 'com.github.bumptech.glide:glide:4.10.0'
kapt 'com.github.bumptech.glide:compiler:4.10.0'
//butterknife dependency
implementation 'com.jakewharton:butterknife:10.1.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
}
apply plugin: 'com.google.gms.google-services'
(Module: Project) level build.gradle file using latest google services plugin 4.2.0 and
build:gradle version 3.5.2
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.40'
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belongs
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscript {
ext.kotlin_version = '1.3.40'
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belongs
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}