#79 Error when updating/installing

Closed
opened 2 years ago by nicknaame · 10 comments

Hi, thank you for maintaining FFUpdater :)
After the update to FFUpdater version 74.3.5 there is unfortunately a new error:

java.lang.IllegalArgumentException at FingerprintValidator.kt:32
java.lang.IllegalArgumentException

java.lang.IllegalArgumentException: file must exists
    at de.marmaro.krt.ffupdater.security.FingerprintValidator.checkApkFile(FingerprintValidator.kt:32)
    at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:279)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)


Android Version: 30
Device Manufacturer: Xiaomi
Device Model: Redmi Note 4

FFUpdater has permission to install unknown apps.
After download there are files in /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download but not in /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/cache. Maybe that is related to this error.

Hi, thank you for maintaining FFUpdater :) After the update to FFUpdater version 74.3.5 there is unfortunately a new error: ``` java.lang.IllegalArgumentException at FingerprintValidator.kt:32 java.lang.IllegalArgumentException java.lang.IllegalArgumentException: file must exists at de.marmaro.krt.ffupdater.security.FingerprintValidator.checkApkFile(FingerprintValidator.kt:32) at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:279) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Android Version: 30 Device Manufacturer: Xiaomi Device Model: Redmi Note 4 ``` FFUpdater has permission to install unknown apps. After download there are files in `/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download` but not in `/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/cache`. Maybe that is related to this error.
Tobiwan commented 2 years ago
Owner

Hi, thank you for maintaining FFUpdater :)

Thanks :)

This is a strange error. Can you try disabling "MIUI Optimization" on your Xiaomi smartphone?

> Hi, thank you for maintaining FFUpdater :) Thanks :) This is a strange error. Can you try disabling "MIUI Optimization" on your Xiaomi smartphone?
nicknaame commented 2 years ago
Poster

Oh, sorry I forgot to mention, I am running on LineageOS 18.1 (https://forum.xda-developers.com/t/ota-aug-08-2021-4-9-fully-stable-high-perf-rom-android-11-lineageos-18-1-mido-vanilla-by-zeelog.4186179/), so there is no "MIUI Optimization".

Now I retried and this additional error occurs:

kotlin.io.NoSuchFileException at DownloadedApkCache.kt:20
kotlin.io.NoSuchFileException

kotlin.io.NoSuchFileException: /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download/FIREFOX_KLAR__2021_08_09__835063703.apk: The source file doesn't exist.
    at kotlin.io.FilesKt__UtilsKt.copyTo(Utils.kt:219)
    at kotlin.io.FilesKt__UtilsKt.copyTo$default(Utils.kt:217)
    at de.marmaro.krt.ffupdater.download.DownloadedApkCache.copyFileToCache(DownloadedApkCache.kt:20)
    at de.marmaro.krt.ffupdater.background.BackgroundJob.downloadUpdateInBackground(BackgroundJob.kt:138)
    at de.marmaro.krt.ffupdater.background.BackgroundJob.access$downloadUpdateInBackground(BackgroundJob.kt:29)
    at de.marmaro.krt.ffupdater.background.BackgroundJob$downloadUpdateInBackground$1.invokeSuspend(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)


Android Version: 30
Device Manufacturer: Xiaomi
Device Model: Redmi Note 4

After both crashes, these files are in the directory:

/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download #
ls -la
total 376516
drwxrwx--x 2 u0_a389 sdcard_rw     4096 2021-08-09 10:21 .
drwxrwx--x 3 u0_a389 sdcard_rw     4096 2021-08-09 10:18 ..
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:19 FIREFOX_KLAR__2021_08_09__1019978717
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__1035437730
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:20 FIREFOX_KLAR__2021_08_09__1395151558
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__1828101760
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__63378547
-rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__835063703
Oh, sorry I forgot to mention, I am running on LineageOS 18.1 (https://forum.xda-developers.com/t/ota-aug-08-2021-4-9-fully-stable-high-perf-rom-android-11-lineageos-18-1-mido-vanilla-by-zeelog.4186179/), so there is no "MIUI Optimization". Now I retried and this additional error occurs: ``` kotlin.io.NoSuchFileException at DownloadedApkCache.kt:20 kotlin.io.NoSuchFileException kotlin.io.NoSuchFileException: /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download/FIREFOX_KLAR__2021_08_09__835063703.apk: The source file doesn't exist. at kotlin.io.FilesKt__UtilsKt.copyTo(Utils.kt:219) at kotlin.io.FilesKt__UtilsKt.copyTo$default(Utils.kt:217) at de.marmaro.krt.ffupdater.download.DownloadedApkCache.copyFileToCache(DownloadedApkCache.kt:20) at de.marmaro.krt.ffupdater.background.BackgroundJob.downloadUpdateInBackground(BackgroundJob.kt:138) at de.marmaro.krt.ffupdater.background.BackgroundJob.access$downloadUpdateInBackground(BackgroundJob.kt:29) at de.marmaro.krt.ffupdater.background.BackgroundJob$downloadUpdateInBackground$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Android Version: 30 Device Manufacturer: Xiaomi Device Model: Redmi Note 4 ``` After both crashes, these files are in the directory: ``` /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download # ls -la total 376516 drwxrwx--x 2 u0_a389 sdcard_rw 4096 2021-08-09 10:21 . drwxrwx--x 3 u0_a389 sdcard_rw 4096 2021-08-09 10:18 .. -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:19 FIREFOX_KLAR__2021_08_09__1019978717 -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__1035437730 -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:20 FIREFOX_KLAR__2021_08_09__1395151558 -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__1828101760 -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__63378547 -rw-rw---- 1 u0_a389 sdcard_rw 64252950 2021-08-09 10:21 FIREFOX_KLAR__2021_08_09__835063703 ```
Tobiwan commented 2 years ago
Owner

This is the normal process:

  1. The system download manager will download the APK file to the "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download" folder because the download manager has access to this folder.
  2. When the download is completed, the signature of the APK file will be checked
  3. When the signature is valid, the APK file will be copied to the "/sdcard/Android/data/de.marmaro.krt.ffupdater/cache/Download" folder. (Why? This file in the cache folder will be used as a cache. When the APK file was downloaded in the background, this cache will be used when the user installs the update. And the user can delete all cached APK files in the Android App settings menu). The "Install Application" button will be displayed.
  4. The user clicks on the "Install Application" and Android installs the APK file from "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download".

The files from "files/Download" will be deleted when the app is "freshly" started after a while (for developers: "onCreate()") [TODO @me: I should improve that by moving or copy+deleting the APK file from files/Download to cache/Download]

Your first error was caused in step 2 and your second error was caused in step 3.

Can you double check if the files in the "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/files/Download" folder has no file extensions?

Your second error was caused because the file "FIREFOX_KLAR__2021_08_09__835063703.apk" doesn't exists. There is only the file "FIREFOX_KLAR__2021_08_09__835063703".

Maybe your system download manager does something strange and does not name the downloaded files correctly?

This is the normal process: 1. The system download manager will download the APK file to the "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/**files**/Download" folder because the download manager has access to this folder. 2. When the download is completed, the signature of the APK file will be checked 3. When the signature is valid, the APK file will be copied to the "/sdcard/Android/data/de.marmaro.krt.ffupdater/**cache**/Download" folder. (Why? This file in the cache folder will be used as a cache. When the APK file was downloaded in the background, this cache will be used when the user installs the update. And the user can delete all cached APK files in the Android App settings menu). The "Install Application" button will be displayed. 4. The user clicks on the "Install Application" and Android installs the APK file from "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/**files**/Download". The files from "**files**/Download" will be deleted when the app is "freshly" started after a while (for developers: "onCreate()") [TODO @me: I should improve that by moving or copy+deleting the APK file from **files**/Download to **cache**/Download] Your first error was caused in step 2 and your second error was caused in step 3. Can you double check if the files in the "/storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/**files**/Download" folder has no file extensions? Your second error was caused because the file "``FIREFOX_KLAR__2021_08_09__835063703.apk``" doesn't exists. There is only the file "``FIREFOX_KLAR__2021_08_09__835063703``". Maybe your system download manager does something strange and does not name the downloaded files correctly?
nicknaame commented 2 years ago
Poster

Hi, yes these files have no extensions (I checked it in file manager and termux).
I don't know what's wrong with my download manager, but I used FFUpdater a long time and it worked perfectly until a few weeks ago. Now I tried to change the file extension manually and it works. So the problem seems that the file extension is missing.

Hi, yes these files have no extensions (I checked it in file manager and termux). I don't know what's wrong with my download manager, but I used FFUpdater a long time and it worked perfectly until a few weeks ago. Now I tried to change the file extension manually and it works. So the problem seems that the file extension is missing.
Tobiwan commented 2 years ago
Owner

Sry for the late response, I'm busy and I will look into it next weekend.

But I suspect (but I'm not sure) that it is an error in the LineageOS version you are using - maybe there are bug reports? The system download manager is used by many apps and should effecting more apps than only FFUpdater.

Sry for the late response, I'm busy and I will look into it next weekend. But I suspect (but I'm not sure) that it is an error in the LineageOS version you are using - maybe there are bug reports? The system download manager is used by many apps and should effecting more apps than only FFUpdater.
nicknaame commented 2 years ago
Poster

I tried to troubleshoot and find the error, but unfortunately I did not succeed. The apps seems to work correctly, but the download manager trims the apk extension.

So, if I am the only one with this problem, please don't waste your time :)
Maybe an update of LineageOS will fix this...

However, I found a dirty quick fix for myself, just remove the apk extension in DownloadManagerAdapter in fileName and it works :D.
You don't need to implement this hack.
This modified version is sufficient for me, so thank you very much :)

I tried to troubleshoot and find the error, but unfortunately I did not succeed. The apps seems to work correctly, but the download manager trims the apk extension. So, if I am the only one with this problem, please don't waste your time :) Maybe an update of LineageOS will fix this... However, I found a dirty quick fix for myself, just remove the apk extension in `DownloadManagerAdapter` in `fileName` and it works :D. You don't need to implement this hack. This modified version is sufficient for me, so thank you very much :)
Tobiwan commented 2 years ago
Owner

I think your are not the only one who has problems with the DownloadManager (https://github.com/Tobi823/ffupdater/issues/62)

I'm going to use the DownloadManager differently now, so I don't have to rely on exactly how the file is saved.

I think your are not the only one who has problems with the DownloadManager (https://github.com/Tobi823/ffupdater/issues/62) I'm going to use the DownloadManager differently now, so I don't have to rely on exactly how the file is saved.
Tobiwan commented 2 years ago
Owner

I think that I fix the bug - can you try it? You can use the APK file from https://github.com/Tobi823/ffupdater/issues/62#issuecomment-908643141

But you have to uninstall the F-Droid version because my APK file is not signed by F-Droid https://github.com/Tobi823/ffupdater#temporary-builds

I think that I fix the bug - can you try it? You can use the APK file from https://github.com/Tobi823/ffupdater/issues/62#issuecomment-908643141 But you have to uninstall the F-Droid version because my APK file is not signed by F-Droid https://github.com/Tobi823/ffupdater#temporary-builds
Tobiwan commented 2 years ago
Owner

Should be fixed in version 74.4.0. This version should be available on F-Droid in the next days. My self-signed version is available on https://github.com/Tobi823/ffupdater#temporary-builds

Should be fixed in version 74.4.0. This version should be available on F-Droid in the next days. My self-signed version is available on https://github.com/Tobi823/ffupdater#temporary-builds
nicknaame commented 2 years ago
Poster

Version 74.4.0 works for me. Thank you very much :)

Version 74.4.0 works for me. Thank you very much :)
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.