NoSuchMethodError: No static method zzb - android

I just upgraded my Android Studio Version from 2.1 to 2.2.2 and I also upgraded a bunch of other Google dependencies (play services and all support libraries) to version 25.0.0.
I also upgraded gradle version to 2.2.2 and compiledSdkVersion to 25.
Well, I just made everything as up to date as possible.
Now when I run my app, I suddenly get this very weird crash as soon as the app launches.
java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzab; or its super classes (declaration of 'com.google.android.gms.common.internal.zzab' appears in /data/app/com.avantcar.a2go-1/base.apk:classes72.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:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Has anyone seen this before and knows how to fix it?

I also saw this since a couple days ago after updating my sdk. This works for me:
Update your firebase library to version 10. You can do this by updating into these lines in build.gradle file:
compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.0'
You may have different firebase component on your project, so adjust accordingly.
But you can change the version to:
compile 'com.google.firebase:firebase-core:+'
compile 'com.google.firebase:firebase-messaging:+'

compile 'com.google.android.gms:play-services:+'
compile 'com.google.firebase:firebase-core:+'
The one that works for me

update all library versions and gms version as well . It will definitely work. Make sure all google services library you are using must be of same version

Related

ArrayIndexOutOfBoundsException at com.huawei.agconnect.crash.internal.log.h$b.read

My application keeps crash report on Crashlytics for ArrayIndexOutOfBoundsException at com.huawei.agconnect.crash.internal.log.h$b.read. I've tried to search around but doesn't seems to get any info on this.
For my recent release, I update my agconnect libraries but still getting this crash. Here are the versions:
build.gradle project
classpath 'com.huawei.agconnect:agcp:1.7.2.300'
build.gradle app
implementation 'com.huawei.hms:base:6.6.0.300'
implementation 'com.huawei.agconnect:agconnect-core:1.7.2.300'
implementation 'com.huawei.hms:hianalytics:6.7.0.300'
implementation 'com.huawei.agconnect:agconnect-crash:1.7.2.300'
implementation 'com.huawei.hms:push:6.7.0.300'
implementation 'com.huawei.agconnect:agconnect-remoteconfig:1.7.2.300'
From the report, all crashes are for Huawei devices and 90%+ are Android 10. The rest are Android 11.
This is the stacktrace shown in Crashlytics:
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException:
at com.huawei.agconnect.crash.internal.log.h$b.read(:51)
at com.huawei.agconnect.crash.internal.log.e$1.a(:15)
at com.huawei.agconnect.crash.internal.log.h.a(:21)
at com.huawei.agconnect.crash.internal.log.e.a(:28)
at com.huawei.agconnect.crash.internal.log.f.b(:8)
at com.huawei.agconnect.crash.internal.log.d.a(:215)
at com.huawei.agconnect.crash.internal.log.c.a(:10)
at com.huawei.agconnect.crash.internal.log.a$4.run(:6)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)
Not exactly sure, but this line appears questionable to me:
implementation 'com.huawei.hms:base:6.6.0.300'
base should use the same HMS version 6.7.0.300, alike the other libraries.
If not, the only chance to pinpoint this is to check out the decompiled class com.huawei.agconnect.crash.internal.log.h$b.read at line 51 (give or take).
This would at least provide a clue, which array it tries to access there ...
Try to update all Huawei dependencies to 6.7.0.300 vesion.
After 1 month or so update to the latest Huawei Agconnect, I no longer receiving this crash report. Now this is the version I'm using:
implementation 'com.huawei.hms:base:6.8.0.300'
implementation 'com.huawei.agconnect:agconnect-core:1.7.3.300'
implementation 'com.huawei.hms:hianalytics:6.8.0.300'
implementation 'com.huawei.agconnect:agconnect-crash:1.7.3.300'
implementation 'com.huawei.hms:push:6.7.0.300'
implementation 'com.huawei.agconnect:agconnect-remoteconfig:1.7.3.300'

android localytics 4.5.1 crash NoClassDefFoundError com.localytics.android.BackgroundService

I updated my localytics from 4.2 to 4.5.
I updated my firebase to the latest ver also 11.6.0.
I am using gradle:
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.localytics.android:library:4.5.1'
compile 'com.android.support:appcompat-v7:26.1.0'
Unfortunately the app is crashing at launch time with this trace:
java.lang.NoClassDefFoundError: com.localytics.android.BackgroundService
at com.localytics.android.ManifestHandler.cancelBackgroundTask(ManifestHandler.java:180)
at com.localytics.android.ManifestHandler._onUploadCompleted(ManifestHandler.java:162)
at com.localytics.android.BaseHandler._uploadCallback(BaseHandler.java:326)
at com.localytics.android.BaseHandler$3.run(BaseHandler.java:129)
at com.localytics.android.BaseProvider.runBatchTransaction(BaseProvider.java:403)
at com.localytics.android.BaseHandler._runBatchTransactionOnProvider(BaseHandler.java:154)
at com.localytics.android.BaseHandler.handleMessage(BaseHandler.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
I have no idea how to fix this (besides reverting to the older version).
Track what is missing and add it. In my case it was gcm dependency.
implementation "com.google.android.gms:play-services-gcm:11.6.2"
You can also try upgrade your support library versions and buildToolsVersion to latest version.

android - java.lang.NoClassDefFoundError Samsung s5 - 4.4.2 [duplicate]

So far I got this error only for one user, who uses a rooted phone (SM-G900R7 Android 4.4.2). The error is like this:
Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/drawable/Icon
at java.lang.Class.getDeclaredMethods(Class.java)
at java.lang.Class.getDeclaredMethods(Class.java:656)
at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
at android.view.ViewDebug.dumpView(ViewDebug.java:900)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:870)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dump(ViewDebug.java:793)
at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
at android.view.IWindow$Stub.onTransact(IWindow.java:65)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(NativeStart.java)
I never use android.graphics.drawable.Icon in my code, all usages are from android.support.v4.graphics.drawable.IconCompat and I also never use that class in my code...
Btw my support library is version 26.0.0, my minSdkVersion is 15 targetSdkVersion is 26.
Thanks
Update
The issue is fixed in support library 27.0.0. If you update don't forget to change compileSdkVersion 27 as well.
What is happening?
Samsung devices with Android 4.4 crash like this when classes extending View define methods which return or take parameters of types that are not on classpath.
Starting with support library version 25.4.0 AppCompatImageView and AppCompatImageButton incorrectly overrides setImageIcon(Icon) method. Since Icon class was introduced in API 23 the app crashes on Samsung devices with API 19.
Similar thing happens when you try to override View.onApplyWindowInsets(WindowInsets).
Workaround for support library 26.1.0
Until this gets fixed in an official manner, If you're stuck with an older version of the support library, I made a modified version of appcompat-v7 where all traces of setImageIcon methods are removed. This means it won't crash on a Samsung with Android 4.4.
Put this at the bottom of your app's build.gradle:
repositories {
maven { url "https://dl.bintray.com/consp1racy/maven" }
}
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'com.android.support' && requested.name == 'appcompat-v7') {
details.useTarget 'net.xpece.android:support-appcompat-v7-fixed:26.1.0-1'
}
}
}
This code will replace appcompat-v7 dependency with the described modified artifact.
Currently the only supported version of the fix is 26.1.0.
Warning: Understand the code before copy-pasting, and always exercise caution when getting code from unknown sources!
This issue was resolved in support library 27.0.0:
Android Gradle Plugin 3.x:
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
Android Gradle Plugin 2.x:
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:support-v4:27.0.0'
Note that you will also need to compile against SDK level 27.
This crash related to 25.4.0 version of support library.
Use 25.3.1 version.
Replace
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
With:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
There are 2 options :
Have you changed the support library version ? this is quite classic library issue when the resources sometimes aren't 'saved' with the same name, or at all. Its not you, its google. Try to use support lib 25, and see if this error still occurs.
Try to clean the project and rebuild. Maybe you're kept with some old library versions in your build folder, and when you build your project it takes old values from it.

Problems updating PlayServices/Firebase from 10.0.1 to 10.2.0

I am developing an android app using Android Studio and got the message today that there is a new version of Google Play services.
I am using Google play services analytics, ads and tag manager. As well as Firebase analytics/messaging/crash.
The version I had in my build.gradle was 10.0.1 and the new version is 10.2.0
But when I change it, the app crashes on start with:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sega.segaid, PID: 15749
java.lang.NoSuchMethodError: com.google.android.gms.internal.zzaac.zza
at com.google.firebase.FirebaseApp.zzcl(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4964)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4559)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5191)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:810)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Is this an error on my side? It crashes before the app even starts. The only thing I changed is updating the used dependencies of the play services and firebase.
The last time something like that happened, it was a bug in Firebase, which was fixed by Google after some days.
EDIT:
build.gradle dependencies
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v13:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.android.gms:play-services-base:10.2.0'
compile 'com.google.android.gms:play-services-tagmanager:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
SOLUTION:
I cleared all caches and also added the version as def instead if writing it out each time. It worked now. Thank you everyone.
I picked the answer by rencsaridogan as solution because I think I forgot to update one of the libraries at my first try and the def is really helpful there. But I also needed to clear caches (as recommended by Avi in the comments below).
There are 2 important things about Google Play Services and Firebase usage as stated in official documentation.
You need to declare the latest classpath of Google Play Services in your root-level gradle, example quoted from given documentation:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Also, as comments suggest in your project every Google Play Services and Firebase package has to have same version, to ensure this you can follow the method given below (It'll be easier like this, you only need to update version number on definitions)
def googlePlayLibVersion = "10.2.0"
def googleFirebaseLibVersion = "10.2.0"
ext {
annotations = "com.android.support:support-annotations:${supportLibVersion}"
firebaseAnalytics = "com.google.firebase:firebase-core:${googleFirebaseLibVersion}"
firebaseCrash = "com.google.firebase:firebase-crash:${googleFirebaseLibVersion}"
googlePlayAds = "com.google.android.gms:play-services-ads:${googlePlayLibVersion}"
googlePlayGcm = "com.google.android.gms:play-services-gcm:${googlePlayLibVersion}"
googlePlayAnalytics = "com.google.android.gms:play-services-analytics:${googlePlayLibVersion}"
}

java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

I upgraded my android studio to 2.1.3. And now I am getting following error
java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompatLollipop; or its super classes (declaration of 'android.support.v4.view.ViewCompatLollipop' appears in /data/data/com.restroshop.restroowner/files/instant-run/dex/slice-internal_impl-24.2.0_7c318f8d2adb03d07a9def5d35a14e39204ecef2-classes.dex)
at android.support.v4.view.ViewCompat$LollipopViewCompatImpl.setOnApplyWindowInsetsListener(ViewCompat.java:1619)
at android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(ViewCompat.java:2924)
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:425)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.restroshop.restroowner.splash.SplashScreen.onCreate(SplashScreen.java:65)
at android.app.Activity.performCreate(Activity.java:6033)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:902)
in line setContentView(R.layout.activity_splash_screen);
My code snippet is
public class SplashScreen extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen); // this line giving error
}
I have no idea what exactly went wrong while upgrading.
I upgraded my android studio to 2.1.3. And now I am getting following error
I am also suffering with same issue. But I was resolved as the following way.
Reason of this exception is AppcompatActivity derived from the v7 library. so we should provide proper library based on your gradle and SDK.
should update the dependency Libraries also.
Right click on the project in the project structure -> select Open module settings and select dependencies tab -> Library module-> then type which library you want add to the project. It shows the latest libraries based on your gradle updated version, then select latest one and remove the existing one.
For example In my project "appcompat-v7" version is 23.4.0 then I was changed to 24.2.0.
I had this error coming due to multiple version of same library.
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.jakewharton:butterknife:8.5.1'
The butterknife was adding the new version of the appcombat lib.
I checked it using
./gradlew -q dependencies app:dependencies
The way gradle works it automatically updates the library to new library version, if available.
So I added the following code
compile('com.jakewharton:butterknife:8.5.1') {
exclude module: 'appcompat-v7'
exclude group: 'com.android.support'
}
It worked fine after that.

Categories

Resources