diff --git a/lib/android/reader_apk.dart b/lib/android/reader_apk.dart index da24b35..a89b5bb 100644 --- a/lib/android/reader_apk.dart +++ b/lib/android/reader_apk.dart @@ -195,7 +195,6 @@ class ApkReader extends IsolateRunner { /// Retrieves installation type (whether installing for the first time, reinstalling the same version, upgrading or downgrading) static Future loadInstallType(String package, int versionCode) async {if (package.isNotEmpty) { - GState.androidPort; String ipAddress = await GState.ipAddress.whenReady(); int port = await GState.androidPort.whenReady(); diff --git a/lib/apk_installer.dart b/lib/apk_installer.dart index 3af084b..3eb9198 100644 --- a/lib/apk_installer.dart +++ b/lib/apk_installer.dart @@ -180,7 +180,7 @@ class _ApkInstallerState extends State { checked: true, style: installType == InstallType.DOWNGRADE ? warningButtonTheme : null, onChanged: !canInstall ? null : (_){ - if (Constants.packageType.directInstall) ApkInstaller.installApk(ApkReader.APK_FILE, ipAddress, port, lang, installType == InstallType.DOWNGRADE); + if (Constants.packageType.directInstall) ApkInstaller.installApk(Constants.packageFile, ipAddress, port, lang, installType == InstallType.DOWNGRADE); else GState.installCallback.$?.call(ipAddress, port, lang, installType == InstallType.DOWNGRADE); }, )), diff --git a/lib/main.dart b/lib/main.dart index 365f9ba..bf8b530 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -180,6 +180,7 @@ bool get isDesktop { class Constants { //static late final List args; + static late final String packageFile; static late final AppPackage packageType; static late final bool installMode; static late final IsolateRef? isolate; @@ -200,6 +201,7 @@ void main(List arguments) async { AppOptions.init(); Constants.installMode = arguments.isNotEmpty; + Constants.packageFile = Constants.installMode ? arguments.first : ''; Constants.packageType = AppPackageType.fromArguments(arguments); Constants.isolate = Constants.installMode ? Constants.packageType.read(arguments.first) : null;