Skip to content

Error during APK update #77

@Taiidzy

Description

@Taiidzy

An error occurs while updating the application.

Log:
I/flutter ( 5284): Начинаем загрузку APK...
I/flutter ( 5284): APK успешно загружен: /data/user/0/space.aniflim.aniflim/cache/update.apk
I/flutter ( 5284): Загрузка завершена. Результат: true
I/flutter ( 5284): Начинаем установку APK...
I/flutter ( 5284): Начинаем установку APK: /data/user/0/space.aniflim.aniflim/cache/update.apk для пакета: space.aniflim.aniflim
I/test ( 5284): onMethodCall:/data/user/0/space.aniflim.aniflim/cache/update.apk,null
I/test ( 5284): getInstallAppIntent:33
I/test ( 5284): getInstallAppIntent:content://space.aniflim.aniflim.installFileProvider.install/cache_path/update.apk
D/DecorView: onWindowFocusChanged hasWindowFocus false
I/InstallPlugin( 5284): handleActivityResult(1024,1,Intent { (has extras) })
I/flutter ( 5284): install apk fail:Install Cancel
I/flutter ( 5284): Установка завершена.
W/aniflim.aniflim( 5284): Reducing the number of considered missed Gc histogram windows from 210 to 100
D/DecorView: onWindowFocusChanged hasWindowFocus true
I/HandWritingStubImpl( 5284): refreshLastKeyboardType: 1
I/HandWritingStubImpl( 5284): getCurrentKeyboardType: 1

Function for downloading and installing APK:

static Future downloadAndInstallApk(BuildContext context) async {
try {
var appDocDir = await getTemporaryDirectory();
String savePath = '${appDocDir.path}/update.apk';
String fileUrl = "https://aniflim.space/app";
// Загрузка APK
debugPrint('Начинаем загрузку APK...');
bool update = await downloadApk(savePath, fileUrl);
debugPrint('Загрузка завершена. Результат: $update');

  // Установка APK
  if (update) {
    debugPrint('Начинаем установку APK...');
    await installApk(savePath);
    debugPrint('Установка завершена.');
  } else {
    debugPrint('Загрузка не удалась, установка не будет выполнена.');
  }
} catch (e) {
  debugPrint('Ошибка в процессе загрузки и установки APK: $e');
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions