1

I have an app with Firebase in it and now the app is crashing while running giving this error: java.lang.NoSuchMethodError: No virtual method zzUV()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.xxx.abc-2/split_lib_dependencies_apk.apk:classes34.dex)

On the line specified below:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Fabric.with(this, new Crashlytics());

        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);            
        setSupportActionBar(toolbar);

        uploadLocationBtn = (AppCompatButton) findViewById(R.id.upload_location);

        uploadLocationBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // Construct an intent for the place picker
                try {
                    PlacePicker.IntentBuilder intentBuilder =
                            new PlacePicker.IntentBuilder();
                    Intent intent = intentBuilder.build(MainActivity.this);
                    // Start the intent by requesting a result,
                    // identified by a request code.
                    startActivityForResult(intent, PLACE_PICKER_REQUEST);

                } catch (GooglePlayServicesRepairableException e) {
                    Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
                    // ...
                } catch (GooglePlayServicesNotAvailableException e) {
                    Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
                    // ...
                }
            }
        });

        // error on this line below
        auth = FirebaseAuth.getInstance();
        if (auth.getCurrentUser() != null) {
            // already signed in
            Toast.makeText(getBaseContext(), "Hello, " + auth.getCurrentUser().getDisplayName(), Toast.LENGTH_SHORT).show();
            logUser();
        } else {
            // not signed in
            Intent intent = new Intent(MainActivity.this, SignUpActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);

            Toast.makeText(getBaseContext(), "sent from 2", Toast.LENGTH_SHORT).show();
        }

    }

Here's build.gradle (Module: app):

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.xxx.abc"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.firebaseui:firebase-ui-auth:1.2.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.google.firebase:firebase-database:10.2.4'
    compile 'com.google.android.gms:play-services-location:10.2.4'
    compile 'com.google.android.gms:play-services-places:10.2.4'
}

apply plugin: 'com.google.gms.google-services'

Here's build.gradle (Project: projectName):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'io.fabric.tools:gradle:1.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Why am I getting this error? What's going wrong here?

KENdi
  • 7,576
  • 2
  • 16
  • 31
Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133

1 Answers1

0

It looks like multidex issue.

When you integrate Google Play Services, It is better to enable MultiDex feature.

Please refer Enabling MultiDex - stackoverflow to know how to enable MultiDex.

Please refer MultiDex - android official to know more about MultiDex.

Community
  • 1
  • 1
Nagaraj N
  • 457
  • 6
  • 13
  • enabling multidex didn't helped. – Hammad Nasir May 17 '17 at 11:55
  • 1
    There is version mismatch in your build.gradle file. Please ref [AuthUI-Firebase Database](https://github.com/firebase/FirebaseUI-Android) version table. Since you are using FirebaseUI 1.2.0, Please change firebase database and google play services version as 10.2.0 – Nagaraj N May 17 '17 at 12:12
  • Enabling multidex isn't a solution, it only helps when you've reached the 65K method limit. And even then you should configure ProGuard instead. – Mike Gouline Aug 24 '17 at 10:42