Android Studio / Play store - Released Version compiled successfully but crashes - android

I released an update of my app and encountered following problems:
The version I uploaded crashes because of a ClassCastException. Although when checking the code this can't be true.
Observations
Android Studio compiled successfully => no problemss occurred
PlayStore uploaded successfully => no problems occurred
The upload of the file is checked with a hash value of the apk isn't it? So this can't be the problem.
Can it be something in Android Studio? Is there some setting I can enable to check the release apk? To make sure nothing went wrong?
My solution was to recompile the app without any changes after a clean and it works again...
Question
Can anyone explain how this can happen?
Does anyone have tipps how I can avoid this? (besides always trying the release apk on my own phone... i must admit I don't do this, as I use my app in debug version permanently...)

This can happen from time to time when switching build types, or checking out a different branch of your repository if you don't clean your project.
My advice would be to always do a clean build when you perform either of these two actions, which will avoid the problem. It will not always be caught during an incremental compile because the cached code is still valid code (albeit with stale references).
Also, not testing your release version before publishing is a bad idea. Better to spend an hour making sure it works than release something that's no good for your users and could easily result in your app being uninstalled.

Related

Getting "App Not Installed" message after attempting to install new version of Android app

I have an app that I developed wow like 8 to 10 years ago, but I have been updating it constantly at least once a year or so.
I'm actually in the process of completely redoing the app from scratch, and it's working great when I run it on my Android from my computer, but when I build it with a signing key on PhoneGap Build, I get the error message "App Not Installed." when I try to install the apk.
I've read through several other posts on the topic and I can attest:
I have plenty of storage space on the phone.
The new version number is larger than the old version number.
The signing key is the same as the original version.
I do not have any version of the app currently installed on my phone.
Any other ideas on what may be causing this?
I've removed all my plugins to take that out of the equation, but I still get the same error.
The original app was build with OnsenUI and Cordova.
The new app is build in Ionic 5.4.16, Cordova 9.0.0, and Android 8.1.0.
Something else I have noticed is that if I change the app id (com.company.appname) to anything else (i.e. com.company.appnamedev), it installs. I feel like this is very indicative of the issue, but I don't know what to do with it.
Very much appreciate any guidance to finding the problem.
Unfortunately this isn't going to be the answer many of you solution seekers are hoping for, but I got it to work. Based on Mike N.'s suggestion, I attempted to sign it locally and push it to my device with adb. In doing that, I was having trouble with remnants of two older plugins (onesignal and admob) that I had already removed from my config.xml file.
I'm really not sure why, but after I got rid of those old pieces in my package.json, I attempt to push it to phonegap build again and it was able to install. So, I guess the solution would be to make sure you have fully removed any plugins that may be causing problems.
Now the big trick - adding these pieces of functionality back in. But, the app compiles on PhoneGap Build and the signed file installs on my device now.
UPDATE: So, it turns out this is directly related to the one signal plugin I'm using. Still figuring out why, but when I added it back in, it works great locally, but when I attempt to build with PhoneGap Build and load it to my phone, I get the error "App Not Installed." At least I know what's causing it now.
I finally figured out the root of all my issues. As it turns out, I had another half baked app I started and had on my phone under a different name and app identifier, but I had temporarily dropped the same google-services.json and GoogleService-Info.plist files into that other app that I use for the one in question here.
After employing Mike N's suggestion, I got the error:
adb: failed to install mynewapp.apk: Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.company.new attempting to redeclare permission com.company.new.permission.RECEIVE_ADM_MESSAGE already owned by com.company.old]
I uninstalled the old app that should not have had those files to begin with and everything installs and works great now. Hopefully this helps someone else out who encounters the same bizarre situation.
You can use My APK application and installing an apk using My APK Installer (MAI).
If there is an error, it will show the detail (like duplicate permission, provider, mismatch signature,...)

Why is Unity IAP service not working on Android production version?

Something really strange is happening to me with Unity IAP service. Purchases were working correctly until the last version of the app. When uploading the last version, the IAP buttons are not showing any data and are not clickable but nothing has changed in the code that may affect it (in fact the last version includes only minor changes on strings). The error that android studio shows is:
A scripted object (probably UnityEngine.Purchasing.IAPButton?) has a different serialization layout when loading. (Read 32 bytes but expected 624 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
But that was not happening in the immediately previous version of the app. I tried to go back to the previous version using Git but the problem persists. Also, nothing was changed recently in that script and I couldn't find any #ifdef condition.
But here is the weirdest thing: when compiling for production and installing the resulting app to a real device, there is no error! Only after uploading the resulting .aab file to the play store it starts to show the error.
Has anybody dealt with this issue?
It happened to me once and it was fixed by reinstalling unity. I did not need to upgrade Unity version. (I assume that there were some intermediate builds corrupted and uninstalling did the trick).
I hope it helps!

How to resolve "Can't Update the app(Error Code : 901)" error?

I'm migrating one of my live applications from Native to Xamarin. I have successfully done that and now I'm trying to release the same on Google Play Store.
I have generated a release build for the same in Xamarin android. Following are the scenarios which will describe the issue I'm facing -
Fresh Install - As I have a release apk for my application, I'm able to install it on my device and it's working smoothly.
Update Scenario - As I have mentioned earlier that the application is already live which was developed on Native Android, I have installed the live version of the same and tried updating the app using the latest release build that I have generated from Xamarin. In this case I'm getting the issue.
Attached a screenshot for the reference.
What I have tried so far to resolve the issue -
As there are multiple questions related to this issue, I have tried following things to get rid of this issue -
Clear data and Clear Cache of Google Play Store application.
Checked the Signing keys are same as before.
Checked the package name is same as before.
Removed the Google account and added again as per the suggestions.
I need to resolve this error soon, so I can't use the Fresh Install technique as an option.
I am able to identify the issue and fortunate that it got resolved. Sharing it here so if anyone gets stuck for the same issue then they can refer this.
Identified Issue - The issue was quite silly as the version code wasn't getting updated from the UI of Android Manifest even if I was changing the values. That might be the glitch in Xamarin or Visual Studio (for Xamarin).
What I did to resolve this - I manually deleted the declaration of Version Code and other values which weren't changing from AndroidManifest.xml then from the UI section of the Manifest I upgraded the Version Code and build the solution for release. That's how things got resolved at my end.
Hope this helps. Thanks.

Manually updating installed signed APK

I have an app on google play store right now.I just move my previous java code to kotlin since It is much easier for me. The package are all the same. Problem is on my android studio, when I try to execute the release variant I keep having this install_failed_update_incompatible error. On my searching, I have to remove the old app. Now I am a bit worried. I don't my user base to uninstall the app let alone erase all their data. Is there a way I could update the app without uninstalling it? Sort of like when you update an app from google play store? The data and information are retained except that the old apk is remove?
Everything is the same with my previous java project except that now I am using kotlin. package and even the apk signed key are all the same.
PS on emulator(genymotion) the updating works and even retained the previous information data. but on real device it won't
Turns out the apk file release from google play store is a bit different. I don't the difference. I have my old java project executed on release variant on my device and then execute the kotlin version release variant. The update went okay. However when I downloaded my app on google play store and then updated it with my new kotlin version release variant, it failed. Im not sure why but it seems that apk submitted to google play store is being modified.

Android APK crashes on run in release mode, but not in debug mode

I have an application that I built in Android Studio. It used to run just fine and has been released to the store in the past, but for some reason the Release APK won't run when installed. The debug runs fine run via phone or emulator. The debug and release builds both use the same keystore file.
Release mode, the APK crashes immediately on open. I suspect it is a keystore issue, but can't be positive??? Does debug bypass using my keystore even though I have it set?
Anything else that I could possibly try?
NOTE: I have another flavor that uses a different keystore and that one works fine.
As requested here as answer :)
Connect the phone to the pc via USB, have android studio open, go to Android Monitor, select your device and look at logcat. I am pretty sure, the exception is there, just waiting for someone to read it. Android Studio logcat logs even store apk's. so publish the release to your phone and just connect it
Thank you, #Adam
Have you used proguard?
If yes I am dam sure its your proguard issue. I would suggest you please read proguard guideline before using it.
It's not proguard. I spent almost two months with this issue of debug build working while release build doesn't work and messed with the proguard files countless times. The problem was instant run. After removing all references to instant run, it finally worked.
You may be able to get additional information by enabling the debugger during release mode. Take a look at this SO thread: Enable LogCat on Release Build in Android Studio. That way you'll be able to see a traceback of the error that's being thrown.
In my case, while opening the release APK the app was crashing. The best way is to see the logcat for knowing the cause of Error. If you have not written any Proguard rules then just goto your build.gradle and change your "minifyEnabled false". This is because ProGuard is obfuscating your APK to make it harder for hackers to reverse-engineering your APK. If you think obfuscation is not needed, change this in your Gradle configuration.just look here.

Categories

Resources