HBiSoft / PickiT

An Android library that returns real paths from Uri's
MIT License
292 stars 54 forks source link

Caused by: java.lang.IllegalArgumentException: Invalid column latitude #17

Closed Mouadabdelghafouraitali closed 4 years ago

Mouadabdelghafouraitali commented 4 years ago

Hi, massive thanks for this library, I have an issue, when I select a video file from (Google Photos App), I get the following exception :

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:399)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.IllegalArgumentException: Invalid column latitude
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:423)
        at android.content.ContentResolver.query(ContentResolver.java:944)
        at android.content.ContentResolver.query(ContentResolver.java:880)
        at android.content.ContentResolver.query(ContentResolver.java:836)
        at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:57)
        at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:19)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

The issue happens only on Android 10.0 (API 29) | Emulator, and works perfectly on other versions

Full scenario :

Start choosing a video file by clicking on the pick button > From the menu, choosing the Google Photos App> App crash immediately

HBiSoft commented 4 years ago

Try enabling legacy external storage in your manifest:

<manifest ... >
    <application 
        android:requestLegacyExternalStorage="true"  >

    </application>
</manifest>
Mouadabdelghafouraitali commented 4 years ago

@HBiSoft I've already enabled it, the issue happens with Google Photos Only , if I choose another Gallery app, it works

HBiSoft commented 4 years ago

@Mouadabdelghafouraitali Does it happen with the demo application as well?

HBiSoft commented 4 years ago

Ok, I was able to reproduce this, I will see if I can find a solution. Why would you want to select a video from Google Photos?

HBiSoft commented 4 years ago

@Mouadabdelghafouraitali I've done some tests and I've also asked a question on StackOverflow.

What I have noticed from my tests is that I do not get the crash when specifying intent.setType("image/*"); instead of intent.setType("video/*");. I guess that Google Photos automatically queries the latitude column when selecting a video file, which is not allowed in Android 10. Google Photos is intended for selecting photos (thus the name "Photos"), but it should still not give this error.

The issue is not with the library, but instead with Google Photos. I will open an issue and try to get feedback from Google.

I will be closing this issue since there is nothing I can do from my end. I will update you when/if I get a response from Google.


EDIT:

I have opened an issue on issuetracker, I will update the issue when I get feedback.

hantash07 commented 3 years ago

I got the solution. Check my answer here:

https://stackoverflow.com/questions/61586124/illegalargumentexception-invalid-column-latitude/65776020#65776020