1

I have successfully build a signed APK and installed it on my device. Then, I uninstall the app (Setting -> Application Manager -> MyApp -> Uninstall) and try to install it again. The second time I try to install it I get "App not installed" with the following stack trace:

12-03 14:37:12.785 834-859/? E/Parcel: Class not found when unmarshalling: com.android.packageinstaller.InstallFlowAnalytics
    java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:324)
        at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
        at android.os.Parcel.readParcelable(Parcel.java:2358)
        at android.os.Parcel.readValue(Parcel.java:2264)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
        at android.os.BaseBundle.unparcel(BaseBundle.java:221)
        at android.os.BaseBundle.getString(BaseBundle.java:920)
        at android.content.Intent.getStringExtra(Intent.java:6183)
        at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2695)
        at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2157)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6333)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6111)
        at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3983)
        at android.os.Binder.execTransact(Binder.java:453)
     Caused by: java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:324) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:2404) 
        at android.os.Parcel.readParcelable(Parcel.java:2358) 
        at android.os.Parcel.readValue(Parcel.java:2264) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2614) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:221) 
        at android.os.BaseBundle.getString(BaseBundle.java:920) 
        at android.content.Intent.getStringExtra(Intent.java:6183) 
        at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2695) 
        at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2157) 
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6333) 
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6111) 
        at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170) 
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3983) 
        at android.os.Binder.execTransact(Binder.java:453) 
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

If I increase the versionCode and repeat the process I am, again, able to install the app the first time, but it doesn't work to uninstall it and install it again.

I have already tried this on 3 different devices. I have tried signing only using "V1 (Jar signature)" AND also tried signing both V1 and V2.

How can I solve this issue?

Update 0: The first time I try to install (which is the only time I'm able to) it shows a popup "Blocked by Play Protect" with the option "INSTALL ANYWAY", which is the option I use.

Diogo Melo
  • 1,735
  • 3
  • 20
  • 29
  • Have you tested on other phone? The problem may be device specific – user1209216 Dec 03 '18 at 16:51
  • check this link https://stackoverflow.com/questions/42889724/apk-cannot-install – nima moradi Dec 03 '18 at 16:52
  • it also might be pro guard problem – nima moradi Dec 03 '18 at 16:52
  • @user1209216, I have tried on 3 different phones, from different manufacturers and different Android versions. – Diogo Melo Dec 03 '18 at 16:59
  • @nima_moradi, I have seem this post and tried the solutions there, with no good results. I can install the app at first. The problem uninstalling and installing the same file. – Diogo Melo Dec 03 '18 at 17:01
  • @nima_moradi, How can it be a pro guard problem? Do you know how can I solve this? – Diogo Melo Dec 03 '18 at 17:02
  • Do you use ProGuard? Do you have the same issue with new blank project with newly generated sign cert? What java version? Shipped with Android Studio or external? Also try to update Android Studio + Gradle + all dependencies to latest versions – user1209216 Dec 03 '18 at 17:10

1 Answers1

1

Just found the problem. The culprit is Play Protect. If I disable it, then I'm able to reinstall the App. Otherwise, it fails.

I really think this is a bug on Play Protect, because on the first time I install the App, it asks me if I want to block or install the app anyway and, on the next attempt to install the app (same versionCode) it just blocks the installation.

Diogo Melo
  • 1,735
  • 3
  • 20
  • 29