k3b / APhotoManager

Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
GNU General Public License v3.0
224 stars 57 forks source link

Android-8.1: Opening map area filter after closing permissions will cause APhotoManager to crash #175

Open sjl872964789 opened 4 years ago

sjl872964789 commented 4 years ago

Describe the bug Opening map area filter after closing permissions will cause APhotoManager to crash

To Reproduce Steps to reproduce the behavior:

  1. Install APhotoManager
  2. Turn off the storage permission of APhotoManager in settings
  3. Open APhotoManager
  4. Click on the three points in the upper right corner
  5. Click "Map Area Filter"
  6. See error

Expected behavior APhotoManager shouldn't crash anyway

Smartphone (please complete the following information):

Additional context record

Crash Report

06-23 16:12:50.646  2604  2793 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
06-23 16:12:50.646  2604  2793 E AndroidRuntime: Process: de.k3b.android.androFotoFinder, PID: 2604
06-23 16:12:50.646  2604  2793 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at android.os.AsyncTask$3.done(AsyncTask.java:353)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
06-23 16:12:50.646  2604  2793 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Missing SQL Column longitude,latitude or _id
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTask.doInBackground(MarkerLoaderTask.java:118)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTaskWithRecycling.doInBackground(MarkerLoaderTaskWithRecycling.java:74)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTaskWithRecycling.doInBackground(MarkerLoaderTaskWithRecycling.java:37)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at android.os.AsyncTask$2.call(AsyncTask.java:333)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
06-23 16:12:50.646  2604  2793 E AndroidRuntime:        ... 4 more
06-23 16:12:50.646  2604  2726 E SQLiteLog: (14) cannot open file at line 35803 of [605907e73a]
06-23 16:12:50.646  2604  2726 E SQLiteLog: (14) os_unix.c:35803: (2) open(/storage/emulated/0/osmdroid/tiles/cache.db) -
06-23 16:12:50.646  2604  2793 E k3bFoto :
06-23 16:12:50.646  2604  2793 E k3bFoto :
06-23 16:12:50.646  2604  2793 E k3bFoto : UncaughtException. Last know Activity
06-23 16:12:50.646  2604  2793 E k3bFoto :
06-23 16:12:50.646  2604  2793 E k3bFoto : => FotoGalleryActivity{0 0}
06-23 16:12:50.646  2604  2793 E k3bFoto : LogCat.uncaughtException java.lang.RuntimeException: An error occurred while executing doInBackground()
06-23 16:12:50.646  2604  2793 E k3bFoto : java.lang.RuntimeException: An error occurred while executing doInBackground()
06-23 16:12:50.646  2604  2793 E k3bFoto :      at android.os.AsyncTask$3.done(AsyncTask.java:353)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.FutureTask.run(FutureTask.java:271)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.lang.Thread.run(Thread.java:764)
06-23 16:12:50.646  2604  2793 E k3bFoto : Caused by: java.lang.IllegalArgumentException: Missing SQL Column longitude,latitude or _id
06-23 16:12:50.646  2604  2793 E k3bFoto :      at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTask.doInBackground(MarkerLoaderTask.java:118)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTaskWithRecycling.doInBackground(MarkerLoaderTaskWithRecycling.java:74)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at de.k3b.android.androFotoFinder.locationmap.MarkerLoaderTaskWithRecycling.doInBackground(MarkerLoaderTaskWithRecycling.java:37)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at android.os.AsyncTask$2.call(AsyncTask.java:333)
06-23 16:12:50.646  2604  2793 E k3bFoto :      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
06-23 16:12:50.646  2604  2793 E k3bFoto :      ... 4 more
k3b commented 4 years ago

Thanks for your feedback

on android-8.1 Caused by: java.lang.IllegalArgumentException: Missing SQL Column longitude,latitude or _id

The app is trying to collect photo-gps-data longitude,latitude to show the markers in the map and android seems to not allow it any more.

Unfortunately i only have android-7.1 device and android emulator does not run on my developer machine so i can not reproduce on my own.

I read that google wants to restrict photo-gps-access.

k3b commented 4 years ago

Today my android lg-k30 got updated from android-7.1 to android-9 and "a photo manager" version 0.8.3 still works as expected without any crash.

can you send me a crash log as described in https://github.com/k3b/APhotoManager/wiki/Problem-Reporting-Logfile-Howto

to see what is going on before and after?

sjl872964789 commented 4 years ago

Thanks for your quick reply. I think this is what you need. androFotofinder.logcat-20200630-144010.txt It is worth mentioning that I found another bug in the process of saving logcat. If the storage permission is denied, I will not be able to save logcat in the corresponding directory, but APhotoManager will still remind me that the save is successful, which once made me feel confused

k3b commented 4 years ago

[OsmDroid] Unable to start the sqlite tile writer. Check external storage availability.

OsmDroid (the openstreemap display library) failed to to put map tile-images into it-s internal sqlite database.

On my android 9 i currently have the mapsforge data in internal memory (/storage/emulated/0) which works as expected.

I assume that mapsforge-data on sdcard does not work yet or the mapsforge-path is not correct.

Since 4 Months (and 88 commits) i am working on saf support https://github.com/k3b/APhotoManager/issues/169

sjl872964789 commented 4 years ago

Sorry, I did not really know whether I use Mapsforge offline map with mapsforge data on sd-card , my settings are like this: 401F4CB4F225CA8D2CEC2304246AEBCC

k3b commented 4 years ago

That screenshot means you are not using "offline maps"

The crash-log let me suggest that the crash happend in a seperate thread.

I just found https://github.com/osmdroid/osmdroid/issues/1313#issuecomment-481238741 which may be related to this issue.

Are you able to compile the "fdroid-branch" of this repository on your own?

If yes you can try to add the code from https://github.com/osmdroid/osmdroid/issues/1313#issuecomment-481238741 to de.k3b.android.androFotoFinder.AndroFotoFinderApp#onCreate()

I have no device where i can reproduce the error with so i cannot verfy if it solves your problem.

If you cannot compile on your own fixing the issue is much more complicated: