Android PackageInstaller install_failed_internal_error: сеанс.Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Android PackageInstaller install_failed_internal_error: сеанс.

Сообщение Anonymous »

Я сталкиваюсь с проблемой, пытаясь установить APK с установщиком пакета. Установка не сбои с очень неясным сообщением о состоянии "install_failed_internal_error: Session Redquised". < /P>
Вот код, который устанавливает пакет: < /p>

Код: Выделить всё

public static void installPackage(Context context, String packageName, String apkPath)
{
Logger.debug("Installing package " + apkPath);
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();

PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);
params.setAppPackageName(packageName);

try {
Logger.debug("Creating session");
int sessionId = packageInstaller.createSession(params);
PackageInstaller.Session session = packageInstaller.openSession(sessionId);

Logger.debug("Copying buffer");
OutputStream out = session.openWrite(packageName, 0, -1);
FileInputStream fileInputStream = new FileInputStream(new File(apkPath));

byte[] buffer = new byte[1024];
int len = fileInputStream.read(buffer);
while(len != -1)
{
out.write(buffer,0, len);
len = fileInputStream.read(buffer);
}

session.fsync(out);
fileInputStream.close();
out.close();

Logger.debug("Buffer copied, sending intent");

Intent intent = new Intent(INSTALL_COMPLETE_ACTION);
IntentSender intentSender = PendingIntent.getBroadcast(context, sessionId,
intent, 0) .getIntentSender();
session.commit(intentSender);
session.close();
}
catch(IOException e)
{
Logger.error("IOException while installing package");
Logger.error(e);
}
catch(Exception e)
{
Logger.error("Unknown exception while installing package");
Logger.error(e);
}
}
< /code>
Вот получатель вещания, который обрабатывает намерение: < /p>
private BroadcastReceiver mInstallReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {

Logger.debug("Received intent");
Logger.debug("Intent action: " + intent.getAction());
int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE);
Logger.debug("Intent status: " + status);
String message = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
Logger.debug("Status message: "  + message);

if(status == PackageInstaller.STATUS_PENDING_USER_ACTION)
{
Intent innerIntent = (Intent) intent.getParcelableExtra(Intent.EXTRA_INTENT);
startActivity(innerIntent);
}
}
};
< /code>
И вот журналы, сгенерированные Broadcastreceiver: < /p>
11-12 15:22:08.364  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:08.365  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:08.365  7179  7179 D DummyActivity @ onReceive()        Intent status: -1
11-12 15:22:08.365  7179  7179 D DummyActivity @ onReceive()        Status message: null
11-12 15:22:08.378  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:08.378  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:08.379  7179  7179 D DummyActivity @ onReceive()        Intent status: -1
11-12 15:22:08.379  7179  7179 D DummyActivity @ onReceive()        Status message: null
11-12 15:22:08.387  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:08.387  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:08.387  7179  7179 D DummyActivity @ onReceive()        Intent status: -1
11-12 15:22:08.388  7179  7179 D DummyActivity @ onReceive()        Status message: null
11-12 15:22:09.155  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.155  7179  7179 D DummyActivity @ onReceive()        Intent status: 1
11-12 15:22:09.155  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_FAILED_INTERNAL_ERROR: Session relinquished
11-12 15:22:09.155  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:09.155  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.156  7179  7179 D DummyActivity @ onReceive()        Intent status: 1
11-12 15:22:09.156  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_FAILED_INTERNAL_ERROR: Session relinquished
11-12 15:22:09.156  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:09.157  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.157  7179  7179 D DummyActivity @ onReceive()        Intent status: 1
11-12 15:22:09.157  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_FAILED_INTERNAL_ERROR: Session relinquished
11-12 15:22:09.214  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:09.214  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.215  7179  7179 D DummyActivity @ onReceive()        Intent status: 4
11-12 15:22:09.215  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_PARSE_FAILED_NOT_APK: Failed parse during installPackageLI: Failed to parse /data/app/vmdl1253852664.tmp
11-12 15:22:09.215  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:09.215  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.215  7179  7179 D DummyActivity @ onReceive()        Intent status: 4
11-12 15:22:09.216  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_PARSE_FAILED_NOT_APK: Failed parse during installPackageLI: Failed to parse /data/app/vmdl1253852664.tmp
11-12 15:22:09.216  7179  7179 D DummyActivity @ onReceive()        Received intent
11-12 15:22:09.216  7179  7179 D DummyActivity @ onReceive()        Intent action: net.test.INSTALL_COMPLETE
11-12 15:22:09.216  7179  7179 D DummyActivity @ onReceive()        Intent status: 4
11-12 15:22:09.216  7179  7179 D DummyActivity @ onReceive()        Status message: INSTALL_PARSE_FAILED_NOT_APK: Failed parse during installPackageLI: Failed to parse /data/app/vmdl1253852664.tmp
заранее спасибо.

Подробнее здесь: https://stackoverflow.com/questions/648 ... linquished
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»