Open Taiidzy opened 10 hours ago
APK installation function:
static Future
debugPrint("Начинаем установку APK: $savePath для пакета: $packageName");
final res = await InstallPlugin.install(savePath);
debugPrint("install apk ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}");
} catch (e) {
debugPrint('Ошибка при установке APK: $e');
}
}
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');
}