App crashes when downloaded from Google Play - android

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.

Related

Trying to TestFlight my Unity Game on Google play Store. Everything uploads but when it goes for review, it fails and it gives be stability error

Error Detected on 1 device during testing
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.messaging/com.google.android.apps.messaging.ui.conversationlist.ShareIntentActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
More info about this..... This expands this..
FATAL EXCEPTION: main
Process: com.google.android.apps.messaging, PID: 26814
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.messaging/com.google.android.apps.messaging.ui.conversationlist.ShareIntentActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2805)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:229)
at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
at android.content.res.Resources.getDrawable(Resources.java:819)
at android.content.Context.getDrawable(Context.java:605)
at ym.a(PG:15)
at com.google.android.apps.messaging.ui.common.ListEmptyView.a(PG:5)
at nog.c(PG:20)
at cy.b(PG:48)
at nol.b(PG:15)
at android.support.v4.app.Fragment.g(PG:120)
at em.f(PG:71)
at ee.a(PG:447)
at ee.c(PG:436)
at ee.d(PG:395)
at ee.a(PG:427)
at ee.b(PG:327)
at ee.a(PG:535)
at ee.c(PG:217)
at ee.c(PG:109)
at ee.i(PG:61)
at di.onStart(PG:114)
at ma.onStart(PG:128)
at vit.onStart(PG:60)
at lkx.onStart(PG:33)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7033)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2768)
... 9 more
Error Detected on 1 device during testing
Fatal AndroidRuntime Exception detected.
Error Detected on 1 device during testing
Native crash of com.Tom.Fireg
4 issues on Android 9 (SDK 28)
I don't know how to fix this, please help me. I got my TestFlight running on AppleStore but it crashes when I play too much so I am trying to fix that. However, on Google PlayStore, I can't even upload due to these errors. Help me please. When I click on android stimulator to run on my unity platform it works fine, just uploading it gives me errors.
I followed this YouTube video how to upload on google playstore. I changed Scripting Backend to IL2CPP in order to enable ARM64. ARMv7 was automatically selected. Just changed Scripting backend and enabled ARM64. Made a key manager to create a key and selected release under Minify. Create symbols.zip on video it said to choose enable. However, I had these options, disabled, public, or debugging. I choose publish since this released map and zip to use on google play. I don't think I did anything wrong here but help me out, please.
Check the packages you have included in the project. They probably weren't included in the Android Manifest.
Android uses the file called Android Manifest within your app to define some basic information.
Among the information he seeks are dependences.
For example if you have implemented a function to send a notification, it will need to be included in the Manifest file.
If there are no dependencies, the app will crash.
Try exporting your game to Android Studio and running it from there. It should show you all the problems.

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

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.** { *; }

Expo - APK bundle must contain the expected embedded asset

I'm new on react, and i tried to run my app but i got this following error
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.bits.bee.bwc, PID: 12601
java.lang.AssertionError: APK bundle must contain the expected embedded asset asset_c2f3d742a18a28238b7cd34a5d4b7316.png
at expo.modules.updates.loader.EmbeddedLoader.copyAllAssets(EmbeddedLoader.java:174)
at expo.modules.updates.loader.EmbeddedLoader.processManifest(EmbeddedLoader.java:137)
at expo.modules.updates.loader.EmbeddedLoader.loadEmbeddedUpdate(EmbeddedLoader.java:57)
at expo.modules.updates.UpdatesController.start(UpdatesController.java:286)
at expo.modules.updates.UpdatesController.initialize(UpdatesController.java:96)
at com.bits.bee.bwc.MainApplication.onCreate(MainApplication.java:98)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4552)
at android.app.ActivityThread.access$1500(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5255)
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:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Can someone explain to me how it's work because i looked it up in my asset folder there's nothing named like that. And how do i fix this? Thanks
Info
This exception only happened to me when running a debug build with react-native run-android and the exception did not appear when running a release build with react-native run-android --variant=release.
Solution
Check whether you have the following line in MainApplication.java and if it's there then remove that line:
import com.facebook.react.BuildConfig;
Explanation
The line import com.facebook.react.BuildConfig; causes UpdatesController.initialize(this); to be called in Debug mode which shouldn't happen.
More detail:
When you look at your Stacktrace you posted the line
at com.bits.bee.bwc.MainApplication.onCreate(MainApplication.java:98)
points to UpdatesController.initialize(this);. Including the line above and below that's how it looks like:
if (!BuildConfig.DEBUG) {
UpdatesController.initialize(this);
}
This BuildConfig here points to the BuildConfig class of your package (com.bits.bee.bwc in your case) which is created during the build. If you import com.facebook.react.BuildConfig it will point to another BuildConfig class which does not contain the correct DEBUG value you want.
Since BuildConfig.DEBUG will then be undefined or false, UpdatesController.initialize(this); is called although it shouldn't during a debug build. Hence, because assets will be not embedded for debug builds, the copyAllAssets function which is eventually called will not find any assets and we get the above error.
Some Context of why I ended up importing com.facebook.react.BuildConfig;
I was facing the issue of java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so in my release build and followed the advice to add that line as stated here https://stackoverflow.com/questions/57036317/react-native-java-lang-unsatisfiedlinkerror-couldnt-find-dso-to-load-libherm/63048532#answer-62119615. It didn't make a change for the release build and I forgot about it. Only later when I attempted to make a debug build I got this error.. took me quite a while to realize that this added line is the cause of the issue!
What I learned from debugging this issue:
Don't just add things because you think it won't hurt. If it doesn't fulfill a certain purpose or has no effect, remove the change immediately. It can otherwise cause strange side effects later.
If you have build issues with Android, debug with Android Studio instead of Flipper. Flipper doesn't display you the entire Stacktrace and in Android Studio you can easily browse through all the Java files which eventually helped me to understand this Exception.

Google Play Dev Console showing Class and Method names in Stacktrace

I have an app with Proguard enabled (minifyenabled true) and recently got a crash report in the Google Play Dev Console. When I looked at it, I saw
the following:
I was surprised to see the full class and method names in line 1, as Proguard is enabled. I've always previously seen things like this:
at com.myname.myapp.c.f (Unknown Source)
I'm also curious how the line number is appearing as I'm not preserving line numbers in my Proguard config file (hence, why I usually see 'Unknown Source' in my stacktraces).
I decompiled my .apk, peeked at the classes.dex file and it all looked OK. I located the class referenced in line 1 of the stacktrace and the class name was indeed obfuscated, as was the method name.
Now, 'MyActivity' (line 2 of the stacktrace) is the launch Activity of my app, and as such is declared in the Manifest, so I understand why it's name is not obfuscated, and the 'onConnected' method is not a method of mine (it comes from Google Play Games Services), so, again, this is OK.
'MyMethodName' is called from within onConnected like so:
#Override
public void onConnected(Bundle arg0) {
myClassObject.myMethodName(); //Where myClassObject is an instance of MyClassName
}
Debug is set to disabled in my build.gradle file.
I don't upload mapping.txt files to the Play Console, I run retrace manually to see my de-obfuscated stacktraces.
I'd appreciate if someone could help me understand why I'm seeing my full class and method name here? What can/should I do to prevent this?
After weeks of agonising over this, I finally discovered the cause...
Suffice is to say, my released app is completely obfuscated - these de-obfuscated stack traces are coming from my own test device!!
Yes, my own test device running the app directly via Android Studio and unsigned. (And for obvious reason, I don't enable ProGuard on my debug builds).
The device I used for testing this app isn't a 'mainstream' device and the 'name' that appears in the Dev Consol bears no resemblance to the actual name of the device so I didn't notice straight away.
I'm fairly sure this never happened in the past (I've certainly not see it until now) - quite why anyone would want crash reports from their debug builds to appear in the Dev Console along with production build crashes, I don't know.
So, if someone is seeing this problem, check it's not your own debug builds causing the influx of stack traces before anything else!
I don't upload mapping.txt files to the Play Console, I run retrace
manually to see my de-obfuscated stacktraces.
Then you may want to add the mapping.txt to google play which will ensure that your packages and classes names are obfuscated.

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.

Categories

Resources