Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError - android

Getting some very odd behaviour on my Google Play Pre-Launch report, and it's only just started occurring, but I can't pin it down to anything I have changed. I also can't reproduce the issue myself.
Every test device seems to be failing in the pre-launch report (6/6 devices all fail the same way). However repeating the steps on the same build on a real device, I can never recreate it. The stack trace is as follows:
FATAL EXCEPTION: Thread-8
Process: uk.myapp.test, PID: 25312
java.lang.NoSuchMethodError: No static method createWithResource(Landroid/content/res/Resources;Ljava/lang/String;I)Landroidx/core/graphics/drawable/IconCompat; in class Landroidx/core/graphics/drawable/IconCompat; or its super classes (declaration of 'androidx.core.graphics.drawable.IconCompat' appears in base.apk)
at androidx.core.app.NotificationCompat$Action.<init>(NotificationCompat.java:4572)
at com.google.android.exoplayer2.ui.PlayerNotificationManager.createPlaybackActions(PlayerNotificationManager.java:1439)
at com.google.android.exoplayer2.ui.PlayerNotificationManager.<init>(PlayerNotificationManager.java:757)
at com.google.android.exoplayer2.ui.PlayerNotificationManager$Builder.build(PlayerNotificationManager.java:564)
at uk.myapp.test.AudioPlayerService.onCreate(AudioPlayerService.java:96)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3570)
at android.app.ActivityThread.access$1300(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
at android.os.Handler.dispatchMessage(Handler.java:106)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:10)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:7)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:1)
at androidx.test.espresso.base.UiControllerImpl.injectMotionEvent(UiControllerImpl.java:5)
at androidx.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:6)
at androidx.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:1)
at androidx.test.espresso.action.Tap.sendSingleTap(Tap.java:5)
at androidx.test.espresso.action.Tap.-$$Nest$smsendSingleTap(Unknown Source:0)
at androidx.test.espresso.action.Tap$1.sendTap(Tap.java:1)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:4)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:21)
at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform(Unknown Source:0)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Not exactly sure but I think it's an issue with the Robo tests that Firebase test lab uses. I haven't tried using their instrumented tests instead, but it's the only explanation I can currently think of.

I implemented reverting the Firebase BOM version like the other answer suggested, but it didn't (or at least didn't fully resolve) the issue for me. Reverting this other dependency finished solving it for me:
Crashing version:
implementation 'com.google.android.gms:play-services-location:19.0.1'
Working version:
implementation 'com.google.android.gms:play-services-location:18.0.0'

EDIT: initially reverting to 29.0.2 release of Google Firebase BOM (from 29.0.3) fixed the issue for me, however problem has reared it's ugly head again, and excluding all firebase components doesn't fix it, so my original fix was merely a plaster.
I am now using Firebase Test Lab to conduct runs (it's much quicker than pushing builds to Google Play, and having to bump the number each time and wait a day). Firebase Test Lab fails the same way, and much quicker (you get 5 runs a day for free). I can now see that it's something related to R8 code obfuscation.
Setting minifyEnabled to false and it works just fine, setting it to true, it crashes every time.
So it appears to be be releated to this R8 bug: https://issuetracker.google.com/issues/213617215#comment22
For me, I have worked around this issue by adding this to my Proguard rules file. It now passes on Firebase Test Lab.
-keep class androidx.core.graphics.drawable.** { *; }

Related

App crashes when downloaded from Google Play

I've just built and deployed an app to Google Play. It worked well when I was running it through Android Studio but now it crashes when I download it from Google Play. Because this is my first time, I don't even know how to view the crash report/stacktrace of the app that was downloaded from Google Play. I appreciate any and all help.
UPDATE
So I got the stacktrace for the APK. It tells me that my TopImageFragment.java class cannot create my MemeViewModel.java class. I have no clue why its giving this error. Everything works fine as it is. It seems that proguard is indeed phasing out an important class:
2019-04-18 00:46:32.062 8099-8099/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ozbek.onur.memegenerator, PID: 8099
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ozbek.onur.memegenerator/com.ozbek.onur.memegenerator.MainActivity}: java.lang.RuntimeException: Cannot create an instance of class com.ozbek.onur.memegenerator.MemeViewModel
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2853)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2928)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1609)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6703)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
Caused by: java.lang.RuntimeException: Cannot create an instance of class com.ozbek.onur.memegenerator.MemeViewModel
at android.arch.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.java:155)
at android.arch.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.java:210)
at android.arch.lifecycle.ViewModelProvider.get(ViewModelProvider.java:134)
at android.arch.lifecycle.ViewModelProvider.get(ViewModelProvider.java:102)
at com.ozbek.onur.memegenerator.TopImageFragment.onActivityCreated(TopImageFragment.java:89)
This kind of problem usually happens because your app deployed to Google Play was a release build and proguard minified your app and removed a class it shouldn't have. When you build in Android Studio it is a debug build that does not get minified. That's why you see the crash only from Google Play.
Before uploading to Google Play, test out your release APK file on a device and watch logcat for the error. That should tell you what class got removed by mistake and you can correct that by specifying custom proguard rules and trying again until the app stops crashing. Then when you upload to Google Play, you should be good.
You can also enable proguard in a debug build as well by changing your build.gradle file. Then when you run through Android Studio, you should see the same error as you see through Google Play.
One other alternative, you can disable proguard/minification in your release build. However this is not recommended because your app will be larger than it needs to be.
Check if you have any java files that don't have an access modifier. In my experience, just declaring a class without a public or private modifier, causes this problem.
My app suffered the same problem and it was a ProGuard kill.
Because ProGuard renames all classes unless otherwise instructed.
So, in your case, you have to add
#Keep
annotation before your class name MemeViewModel.
example,
#Keep
class MemeViewModel{
//
//
}
In my suggestion, keep your phone connected to your your PC/Laptop while you download and attempt to open it. Use Logcat on android studio, it mostly has all answers or at least errors that lead to the answers. try putting error logs here so we can have a proper look at it.
1) Try the same version of your application that you deployed on Google play store by pushing it through the android studio and see if the problem continues!
2) If same thing happens then put breakpoint on the entry point (onCreate method in most cases in MainActivity class) of your application and Go to Run->Debug "YourProject" option and do step by step debug for each command being executed and see which one is causing problem.

Uri.java line 475 android.net.Uri$StringUri.<init> com.google.android.gms.ads

I'm getting an error from different device versions (Android 5 - Android 8) since I use ads:
implementation 'com.google.android.gms:play-services-ads:16.0.0'
My error looks like this:
Fatal Exception: java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:475)
at android.net.Uri$StringUri.<init>(Uri.java)
at android.net.Uri.parse(Uri.java:437)
at com.google.android.gms.ads.internal.video.a.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):13)
at com.google.android.gms.ads.internal.video.gmsg.f.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):148)
at com.google.android.gms.ads.internal.webview.j.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):293)
at com.google.android.gms.ads.internal.webview.ac.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.google.android.gms.ads.internal.util.e.dispatchMessage(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):5)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
any help is apreciated
There is a bug in version 17.0.0 either you're using
implementation 'com.google.android.gms:play-services-ads:17.0.0' //or
implementation 'com.google.firebase:firebase-ads:17.0.0'
You can check this thread for more detail.
According to the post from Mobile Ads SDK Team member, issue has been fixed but there is no ETA as of now.
EDIT
I found that above issue is not related to particular admob version. From last week most of the apps with AdMob start crashing, It doesn't matter what admob version you're using. I think there is issue with server side or how they delivered ads(may be getting null in response) and not handled in AdMob SDK level.
So Currently we've
Issue with Server side
May be some issue in version 17.0.0
Issue already submitted to Mobile Ads SDK team so we've only option to wait for server side fixes or we may get another release after 17.0.0.
I also encountered this issue when I upgraded my ads dependency to the latest version, to find a proper solution keep checking this thread as mentioned by #Aryan in other answer. As a workaround for now you can use the following dependency:
implementation 'com.google.android.gms:play-services-ads:15.0.0'
this will keep the crash from occurring.

App crash when connecting to google play games - A fatal developer error has occurred

My game stops when I try to connect it with the google play games. It was working. But suddenly this is happening. It's showing development error occurred. Here's the logcat.
07:34.150 2144-2144/com.sennovations.countermaster E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sennovations.countermaster, PID: 2144
java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zze.zzs(Unknown Source)
at com.google.android.gms.common.internal.zzi.zzrk(Unknown Source)
at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
I have added the meta tags in the manifest.
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
Any help would be appreciated. Thanks
Based on your comments I infer that this wasn't your issue, but as I encountered a similar error that I resolved as follows, I'll add this answer:
Google's documentation (here, for instance) currently instructs us to add
compile 'com.google.android.gms:play-services:11.0.4'
to build.gradle. Notice that it currently advises version 11.0.4. Google adds:
Be sure you update this version number each time Google Play services is updated.
This one line appears to be quite possibly some of the worst advice ever given.
Why? Two reasons.
Suppose you use their free BaseGameUtils, which Google itself encourages. Its build.gradle is set up to use version 8.4.0:
ext.gms_library_version = '8.4.0'
I did this, and used the webpage's advice to use version 11.0.4. The disagreement in library numbers caused the app to crash on both Android Studio emulator and a test device with a stack trace similar to the one above.
To be fair, Android Studio will warn you that things can go wrong with the different version numbers: if you open the Manifest file, it will underline the version numbers and whine that it finds two different version numbers, and it will even tell you which version numbers disagree, but -- this is key -- it won't tell you where to find the other file(s) with different version numbers. If you are importing several libraries, and/or compiling dependencies on GitHub or elsewhere, it can be a bit of a challenge to find the cause.
If your app requests Play Games services 11.0.4, but your emulator and/or phone have a lower version number (e.g., 11.0.2 as on my emulator), then the Games API's connect() will give status RESULT_CANCEL to onActivityResult(). The documentation on these result codes leaves something to be desired, so this can take a while to debug -- in fact, I think I think the crashes above were my only clue that the problem might be with the API version number.
There is a way to check that the device supports the requested API, but most of Google's documentation doesn't tell you to do it, and even BaseGameUtils doesn't seem to check for it. (You want to look at GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE.)
In my particular case, the problem was solved by changing my app's play-services version to 8.4.0. Works beautifully now.

Cryptic FCM 10.2.0 Failure - FirebaseInitProvider, NoSuchMethodError

I'm trying to add Firebase Cloud Messaging to my app with no success, as I get the following exception:
1 27336-27336/com.company.here E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.company.here, PID: 27336
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/app/com.company.here.debug-1/base.apk)
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:5883)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5475)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5414)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6154)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Here's what I've checked so far:
google-services is set to 3.0.0 in the project gradle file
I only have one dependency related to firebase, which is 10.2.0
I have jack enabled so I can use lambdas
I have ReactiveAndroid and Retrofit incorporated into the project, perhaps they're interacting badly? That said I didn't see anything suspicious when running ./gradlew app:dependencies
Tried multiDexEnabled = true, didn't make a difference
Had a custom applicationIdSuffix for debug builds, attempted to remove it but it also didn't make a difference
Positioning of apply plug: 'com.google.gms.google-services doesn't seem to matter, currently at end of gradle file
What could be causing this? As best as I can tell, FirebaseInitProvider is calling an internal static method from attachInfo, which in turn attempts to call out to a static method on an SDK-private class that doesn't seem to exist.
So this was weird:
Nothing about my setup changed from last night except I ran the clean project command, added the firebase-core dependency and then built again, and everything started to work.
I had assumed that firebase-messaging pulled all of its dependencies in by itself, but that goes against the setup guide, and the crash makes sense if the internal class FirebaseInitProvider is attempting to access is in the firebase-core dependency.
You probably have a mismatch of one of your play-services dependencies and Firebase in your app level build.gradle.
Having google services at 3.0.0 in your project level build.gradle is fine (com.google.gms:google-services:3.0.0).
For example, if you have dependency com.google.android.gms:play-services-maps:10.2.0 and com.google.firebase:firebase-invites:10.2.0 they must both be the same version 10.2.0.

Android crashlytics app crashes on launch due to TypeNotPresentException

Crashlytics compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') is integrated with the app and is being tested on nexus 7 4.4.4,
The crash is seen from application onCreate method and following stacktrace is obtained. No other similar error/explaination could be found on stackoverflow.
Any suggestions are welcome.
Caused by: java.lang.TypeNotPresentException: Type com/crashlytics/android/core/internal/CrashEventDataProvider not present
at java.lang.Class.getDeclaredAnnotation(Native Method)
at java.lang.Class.getAnnotation(Class.java:290)
at io.fabric.sdk.android.Kit.containsAnnotatedDependency(Kit.java:158)
at io.fabric.sdk.android.Kit.compareTo(Kit.java:140)
at io.fabric.sdk.android.Kit.compareTo(Kit.java:33)
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:291)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:153)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:142)
at java.util.Arrays.sort(Arrays.java:1970)
at java.util.Collections.sort(Collections.java:1864)
at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:401)
at io.fabric.sdk.android.Fabric.init(Fabric.java:375)
at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:332)
at io.fabric.sdk.android.Fabric.with(Fabric.java:303)
at com.xxxx.MainApplication.onCreate(MainApplication.java:19)
Apparently android limiatation of 65K methods is the problem on pre-lollipop devices, the problem is not due to crashalytics library per-se but in general one might run into this problem due to limitation of 65K methods at dalvik level.
Thanks to http://frogermcs.github.io/MultiDex-solution-for-64k-limit-in-Dalvik/ I was able to get the no. of methods in my .apk file.

Categories

Resources