Home > database >  Android app is not launching after updating library version
Android app is not launching after updating library version

Time:12-22

I am trying to upgrade an android old code which was developed in 2017 in JAVA.

I was able to run the code after changing the compile SDK version as 31 and min SDK as 24, the build gradle file has the following

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.firebase:firebase-iid:21.1.0'

The problem i had in the app is not able to get current location and place marker in google map is not working in some API level as some of the google libraries are need to be upgraded, so i have upgraded the following

//    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.android.gms:play-services-location:19.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'

But now i am not able to launch the app in my emulators, I am getting the following error

2021-12-21 08:22:41.115 23867-23867/com.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.app, PID: 23867
    java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzac; or its super classes (declaration of 'com.google.android.gms.common.internal.zzac' appears in /data/app/com.app-hsFG_IEf6owtrU9gHiJ5xQ==/base.apk)
        at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source:2)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:0)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6649)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6172)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6080)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1812)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:183)
        at android.app.ActivityThread.main(ActivityThread.java:6956)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:519)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:836)

How to run the app, the app was running good before updating the libraries

CodePudding user response:

You may have different GSM component on your project, so adjust accordingly.Make sure all google services library you are using must be of same version.

You can get the latest version Here

Also you can change the version to:

implementation 'com.google.android.gms:play-services-location: '
implementation 'com.google.android.gms:play-services-places: '
implementation 'com.google.android.gms:play-services: '
implementation 'com.google.firebase:firebase-iid: '

CodePudding user response:

I am able to run the code after making following changes in the gradle file

buildscript {
    repositories {
        google()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

android {
    defaultConfig {
        minSdkVersion 26
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {

//    implementation 'com.google.android.gms:play-services:12.0.1'
//    implementation 'com.google.firebase:firebase-auth:21.0.1'
//    implementation 'com.google.firebase:firebase-iid:21.1.0'

    implementation 'com.google.android.gms:play-services-location:19.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'

    implementation 'com.google.firebase:firebase-core:20.0.1'
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
}

While updating the gms play services we need to update all other libraries we have implemented for the project

  • Related