5

I get the following error when trying to build my application:

error: cannot access zzbfm class file for com.google.android.gms.internal.zzbfm not found

Here is my build.gradle file code:

apply plugin: 'com.android.application'


android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {

    applicationId "myapplicationid"
    minSdkVersion 21
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 12
    versionName "1.0.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
signingConfigs {
    key {
        keyAlias 'anavasis'
        keyPassword 'anavasis'
             storeFile file('jks_file_path')
        storePassword 'anavasis'
    }
}
buildTypes {
    debug {
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/anim'] } }
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//compile 'com.google.maps.android:android-maps-utils:0.4+'

compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.google.android.gms:play-services:11.8.0'
compile 'io.ticofab.androidgpxparser:parser:0.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:support-v4:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-vector-drawable:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.0'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.android.support:cardview-v7:27.1.0'

compile 'com.google.code.gson:gson:2.4'
compile 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.android.support:multidex:1.0.3'

compile 'com.android.billingclient:billing:1.0'

compile 'com.google.firebase:firebase-core:16.0.1'
compile 'com.google.firebase:firebase-crash:16.0.1'
compile 'com.google.firebase:firebase-auth:16.0.1'


 }

I have checked the answer here https://stackoverflow.com/a/50732851/1465756 but I do not have multiple firebase versions.

If I delete the 3 rows of compile firebase the app is running with no problems BUT I guess I should have them in my build.gradle.

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
arniotaki
  • 2,175
  • 2
  • 23
  • 26

1 Answers1

3

In the top level gradle file use the following:

classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:4.0.2'

To be able to use the latest firebase verisons, also upgrade the Android Studio to version 3.1

If you're not using Android Studio 3.1 to develop your app, you will need to upgrade in order to get the correct version checking behavior within the IDE.

https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html


Also update:

compile 'com.google.android.gms:play-services:11.8.0'

into this:

implementation 'com.google.android.gms:play-services:15.0.1'

Note: Don't use the combined play-services target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.

https://developers.google.com/android/guides/setup

Check this also:

Android | Cannot add all Google libraries for version 15.0.1

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • I have the android studio 3.1.3 and in my project gradle I added the classpaths you suggested (also tried com.android.tools.build:gradle:3.1.3 as suggested by android studio) but nothing worked – arniotaki Jul 31 '18 at 09:53
  • Why are u using compile thought and not implementation? – Peter Haddad Jul 31 '18 at 09:58
  • What is the difference? I tried to turn compile to implementation but again it didn't work – arniotaki Jul 31 '18 at 10:02
  • I was just wondering because it was deprecated in the new gradle https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration#new_configurations (nothing to do with firebase) – Peter Haddad Jul 31 '18 at 10:05
  • check the update @arniotaki You need to also update the google services libraries, just saw that you are using that – Peter Haddad Jul 31 '18 at 10:15
  • I changed as you suggested but instead of 15.0.1 I used 12.0.1 as suggested by android studio because 15.0.1 fails to build gradle. After that changes I get the error error: cannot access zzbgl class file for com.google.android.gms.internal.zzbgl not found – arniotaki Jul 31 '18 at 10:41
  • Failed to resolve: com.google.android.gms:play-services:15.0.1 – arniotaki Jul 31 '18 at 11:16
  • Did you check this https://stackoverflow.com/questions/50309559/failed-to-resolve-com-google-gms-google-services15-0-1#51611685 @arniotaki? ( I even added it in the note that you shouldnt use the combined play-services target) – Peter Haddad Jul 31 '18 at 12:27
  • It is unchecked – arniotaki Jul 31 '18 at 13:42
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/177102/discussion-between-peter-haddad-and-arniotaki). – Peter Haddad Jul 31 '18 at 13:43
  • Please upvote the answer and mark it as correct if it helped you, thank you! – Peter Haddad Aug 02 '18 at 08:27