2

so I have and Android project to which I need to include Firebase messaging api, here is my grande config

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"

    signingConfigs {
        config {
            keyAlias 'XXXXXXX'
            keyPassword 'XXXXXXXX'
            storeFile file('/path/path/etc')
            storePassword 'noiGGW4P6509'
        }
    }

    defaultConfig {
        applicationId "xxx.xxxxxx.xxxxxx"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 37
        versionName "2.0"
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.google.android.gms:play-services-maps:9.2.0'
    compile 'com.google.android.gms:play-services-location:9.2.0'
    compile 'com.google.android.gms:play-services-analytics:9.2.0'
    compile 'com.google.android.gms:play-services-vision:9.2.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.parse:parse-android:1.13.1'
    compile 'com.parse:parseinterceptors:0.0.2'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
    compile('com.facebook.android:facebook-android-sdk:4.8.0') {
        exclude module: 'bolts-android'
    }
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:palette-v7:24.0.0'
    compile 'org.apmem.tools:layouts:1.10@aar'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'jp.wasabeef:picasso-transformations:1.3.1'
    compile 'com.github.glomadrian:loadingballs:1.1@aar'
    compile 'com.vlonjatg.android:app-tour:1.0'
    compile 'com.pixplicity.sharp:library:1.0.2@aar'
    compile 'com.github.hotchemi:android-rate:0.5.6'
    compile 'info.hoang8f:android-segmented:1.0.6'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
    compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
}

I follow the guide to enable multidex support in the app from here https://developer.android.com/studio/build/multidex.html, I have the Application class extended

public class EnsivarApplication extends Application {

    private Tracker mTracker;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

All looks good, the app compile, but when it run in the device (5.0) or simulator (4.3) I get this error

java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/data/net.clevermobileapps.ensivar/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.2.0_18a98179390602e5eecdbb442b4bc7d2fd2324b7-classes.dex)
at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5146)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4741)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4681)
at android.app.ActivityThread.access$1500(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1409)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)

If I remove the firebase lib, all works well, I have no idea why is not working, any help is very much appreciated, thank you!

goseta
  • 770
  • 1
  • 7
  • 26

2 Answers2

6

Use firebase dependency version 9.2.0 as well, to match with google-play-services dependencies.

[EDITED]

Beginning with version 15

Each dependency may be updated individually, removing the need to upgrade them all simultaneously in your app.

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

betorcs
  • 2,771
  • 22
  • 28
  • 1
    Yes, that was the solution, I used the version from the docs, but I did not realize I need to match with the others, thanks again! – goseta Jul 06 '16 at 19:28
0

This is a dependencies issue

The exception clearly says :

com.google.android.gms-play-services

You have so many dependencies that some may collide I guess

With multi-dex enabled several versions of the same lib can exist. It could be a problem

EDIT : Please do some research too : No static method zzUr() in Firebase when I try to use Analytics with Notifications

Community
  • 1
  • 1
An-droid
  • 6,433
  • 9
  • 48
  • 93