java.lang.reflect.InvocationTargetException while inappupdate android if retries

68
August 01, 2019, at 2:20 PM

It sucks when something doesn't work and stacktrace is unclear!.

Steps to reproduce this error:

  1. Click update button & it opens update app dialog since it's AppUpdateType.FLEXIBLE.
  2. Click No, thanks
  3. Try update again. App crashes with following error:

I'm getting this exception while updating the app via inappupdate on following line.

appUpdateManager?.startUpdateFlowForResult(it, AppUpdateType.FLEXIBLE, activity, REQUEST_CODE_FLEXI_UPDATE) //it == AppUpdateInfo object

Stacktrace:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:451)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 
Caused by: android.content.IntentSender$SendIntentException
        at android.app.Activity.startIntentSenderForResultInner(Activity.java:4878)
        at android.app.Activity.startIntentSenderForResult(Activity.java:4847)
        at androidx.fragment.app.FragmentActivity.startIntentSenderForResult(FragmentActivity.java:796)
        at android.app.Activity.startIntentSenderForResult(Activity.java:4814)
        at androidx.fragment.app.FragmentActivity.startIntentSenderForResult(FragmentActivity.java:781)
        at com.google.android.play.core.appupdate.b.startUpdateFlowForResult(Unknown Source:22)
        at newProfile.NewProfileFragment.startForInAppUpdate(NewProfileFragment.kt:752)
        at newProfile.NewProfileFragment.access$startForInAppUpdate(NewProfileFragment.kt:60)
        at newProfile.NewProfileFragment$setupAppUpdate$3.onClick(NewProfileFragment.kt:682)
        at android.view.View.performClick(View.java:6935)
        at android.widget.TextView.performClick(TextView.java:12752)
        at android.view.View$PerformClick.run(View.java:26214)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)

Details:

Android version: 8.0 Phone: Samsung J7

Update

As per documentation, startUpdateFlowForResult should only called for once AppUpdateInfo instance. For calling again, you must create AppUpdateInfo instance.

but since its instance depends on below condition, how to make sure its instance newly gets created before calling startUpdateFlowForResult

 appUpdateManager?.appUpdateInfo?.addOnSuccessListener {
            if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
                    it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
                appUpdateInfo = it
                updateAvailable.value = true
            } else {
                updateAvailable.value = false
            }
        }

Also how to get progress value of app being downloaded, couldn't find it in documentation. In my case, onActivityResult keeps calling but which key gives progress value?

Also facing another issue with different use case: inappupdate not available after skipping installation

READ ALSO
Apply video filter to my local video like MI/ Instagram filters and upload to server

Apply video filter to my local video like MI/ Instagram filters and upload to server

I am trying to add filters on captured videos like MI default filtersI have already gone through https://github

20
Is there a way to run a real-time widget always on foreground

Is there a way to run a real-time widget always on foreground

I am making an app which includes a real-time widget and I want to provide a feature to the users to run that widget always in the foreground

44
StreamReader code is never being executed

StreamReader code is never being executed

I use the following code to read a json file

46
RecyclerView Adapter Item Value being changed incorrectly

RecyclerView Adapter Item Value being changed incorrectly

I'm currently looking to find out if someone can notice anything I'm missing, been looking at this for a while now! I have a list inside a recyclerview and certain questions inside that list can store an image beside it alongside a boolean valueWhen taking...

37