I have a class called CosuUtils
that follows this class pretty closely. I am programmatically updating an application that is a device owner. This works fine in Android 6 but I'm getting the following error when trying to update in Android 7.
PackageInstaller: Commit of session 1108510423 failed: /data/app/vmdl1108510423.tmp/COSU specified package com.mypackage inconsistent with com.mypackage.full
In CosuUtils
I set the package name as such
public static boolean installPackage(Context context, InputStream in, String packageName) throws IOException {
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);
params.setAppPackageName(packageName);
I was passing com.mypackage
to installPackage
which as mentioned earlier works fine on Android 6. This doesn't work in Android 7 unless I use com.mypackage.full
. The issue is this breaks the ability for users who have upgraded to Android 7 to update to the latest version of the app. What changed between Android 6 and 7 that caused it to break and is there a work around for it?