问题
I am trying to integrate the new In-App Update API but I cannot able to test it's implementation. Seems like my code is fine therefore I read the Troubleshoots and am not able to understand 2 points in this document
Make sure that the app that you are testing is signed with the same signing key as the one available from Google Play.
- How can I sign with same signing key in debug mode while installing Apk on Connected device?.
If the app you are testing doesn’t appear with an available update, check that you’ve properly set up your testing tracks.
- Is it compulsory to release App in internal testing tracks to test implementation?
Anyway I just want to test on my device and I decremented the version code from the play store version but its showing always UPDATE_NOT_AVAILABLE
.
Here is code:-
val appUpdateInfo: Task<AppUpdateInfo> = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnSuccessListener {
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
appUpdateManager.startUpdateFlowForResult(it, AppUpdateType.FLEXIBLE, this, 2);
}else{
toast("Not Available")
}
}
回答1:
I installed my app from Google Play. Then I removed it and intalled the signed apk with lower versionCode.
"In-app updates are available only to user accounts that own the app. So, make sure the account you’re using has downloaded your app from Google Play at least once before using the account to test in-app updates." developer.android.com/guide/app-bundle/in-app-updates
回答2:
Also there is FakeAppUpdateManager that was created for such purposes. You can use it.
回答3:
Basic Requirements for Manual Testing
In order to manually perform the full update flow on the test device, you should have at least two versions of the app with the different version number: a source version and a target version.
- The source version with the higher version number should be published at Google Play, this is the version which will be identified by Google Play as an available update. The target version with the lower version number and integrated IAUs(In-App Updates) feature should be installed on your device, this is the version which will be updated. The thing is, when the app requests Google Play to check for available updates, it compares the version number of the installed app with the version number of the last available build-in Google Play. So the IAUs feature will be triggered only in case if the version number in Google Play is higher than actual version of the app on the device.
- Both the source and the target versions need to have the same package name and should be signed with the same release certificate.
- Android 5.0 (API level 21) or higher.
- Play Core library 1.5.0 or higher.
Update is Not Available ERROR
First of all, please double-check the requirements mentioned above. If you successfully complete above listed steps in compliance with all requirements and still getting the error then please pay attention to the following trick. The most likely reason is that the Google Play app does not know about the update yet due to the internal caching mechanism. To make sure you have the cache fresh when testing manually you can refresh the cached version by going to the My Apps & Games screen in the Google Play app. Other, alternative, you can simply clear the cache of the Google Play app in the settings. Note that this is just an issue for testing and does not affect end users since the cache is updated daily anyway.
Note - App Bundle is not mandatory for IAUs.
回答4:
First, you'd have to publish your app to Google Play. Make sure that:
- The version code you published is higher than the one you're going to test the updates with, because if not, then it wouldn't recognize it as an update. Then let the Google Play refresh its cache for quite some time (in my case, I've waited for 12 hours before I was able to make it work for the first time).
- You've signed both apks with the same signature.
If you want to have a working demo app, I've uploaded a git repository with a lower version code than the one that I've published in Google Play.
回答5:
I had the similar issue of having UPDATE_NOT_AVAILABLE. After hours of researching, here is how i solved:
use Google play store to install a version of the testing app (I used internal test track rollout)
rollout another version with higher VERSION CODE on Play Console (the same internal test track)
close both testing app and Google play store (not just back to home, use recent key and swipe them off)
open the Google play store and ensure that testing app has an update available (you can check it under "My Apps & Game" > Installed)
now open the testing app and check for UPDATE_AVAILABLE
This works for me almost immediately after rollout
回答6:
For the first question, they are saying that you need to do a release build of the app, using your release keystore. Then, you could attach the resulting .apk file to an e-mail and e-mail it to yourself. Then, check your e-mail on your android device and download the .apk attachment to your downloads, and at the end of the download, Android should ask if you want to install the .apk, say yes (if it doesn't ask, then click on the file in your downloads folder, and then it should ask).
For the second question, the only way I can imagine testing this through the internal testing tracks since you have to interact with the Google Play storefront, but not affect your live published release.
回答7:
You got a wait after publishing, it takes 2 to 6 hours.
回答8:
As Arpit J. suggested basic main requirements to test the app, if still you are not able to successfully test the app, I would like to add one more last step that would help you to quickly test the app.
Go to play store app info from settings as shown in image, and do clear data as show in attached screenshots. The steps to go to play store app info may vary device by device.
来源:https://stackoverflow.com/questions/56118563/in-app-update-api-showing-update-not-available-while-testing-on-debugging-device