question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for API 29 (Android 10)

See original GitHub issue

I’m getting an SQLiteException when starting FilePickerActivity on a device with API 29. On API 28 it works fine. There is a similar issue for another library.
Device: Android Studio emulator with android 10.0 Lib ver.: 1.2.2 App uses the latest AndroidX libs. compileSdkVersion is 29

I’m starting activity like this:

Intent intent = new Intent(getActivity(), FilePickerActivity.class);
                                intent.putExtra(FilePickerActivity.CONFIGS, new Configurations.Builder()
                                        .setCheckPermission(true)
                                        .setMaxSelection(1)
                                        .setShowAudios(false)
                                        .setShowImages(false)
                                        .setShowVideos(false)
                                        .setShowFiles(true)
                                        .setSuffixes("doc", "docx", "xls", "xlsx")
                                        .build());
                                startActivityForResult(intent, REQUEST_CODE_CHOOSE_FILE);

Logcat:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.example/com.jaiselrahman.filepicker.activity.FilePickerActivity}: android.database.sqlite.SQLiteException: near "GROUP": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT _data FROM files WHERE ((owner_package_name IN ( 'com.android.example' ) OR media_type=2 OR media_type=4 OR media_type=0 AND mime_type LIKE 'audio/%' OR media_type=3 OR media_type=0 AND mime_type LIKE 'video/%' OR media_type=1 OR media_type=0 AND mime_type LIKE 'image/%') AND (is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary' , '1005-1207' ))) AND ((bucket_id IS NOT NULL) GROUP BY (bucket_id)) ORDER BY _data ASC
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: android.database.sqlite.SQLiteException: near "GROUP": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT _data FROM files WHERE ((owner_package_name IN ( 'com.android.example' ) OR media_type=2 OR media_type=4 OR media_type=0 AND mime_type LIKE 'anaudio/%' OR media_type=3 OR media_type=0 AND mime_type LIKE 'video/%' OR media_type=1 OR media_type=0 AND mime_type LIKE 'image/%') AND (is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary' , '1005-1207' ))) AND ((bucket_id IS NOT NULL) GROUP BY (bucket_id)) ORDER BY _data ASC
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184)
        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.jaiselrahman.filepicker.loader.FileLoader.getFoldersToIgnore(FileLoader.java:145)
        at com.jaiselrahman.filepicker.loader.FileLoader.<init>(FileLoader.java:119)
        at com.jaiselrahman.filepicker.loader.FileLoaderCallback.onCreateLoader(FileLoaderCallback.java:63)
        at android.app.LoaderManagerImpl.createLoader(LoaderManager.java:564)
        at android.app.LoaderManagerImpl.createAndInstallLoader(LoaderManager.java:573)
        at android.app.LoaderManagerImpl.initLoader(LoaderManager.java:627)
        at com.jaiselrahman.filepicker.loader.FileLoader.loadFiles(FileLoader.java:179)
        at com.jaiselrahman.filepicker.activity.FilePickerActivity.loadFiles(FilePickerActivity.java:128)
        at com.jaiselrahman.filepicker.activity.FilePickerActivity.onCreate(FilePickerActivity.java:115)
        at android.app.Activity.performCreate(Activity.java:7802)
        at android.app.Activity.performCreate(Activity.java:7791)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7356) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jaiselrahmancommented, Oct 6, 2019

For now it is best to opt out of Scoped Storage feature.

<manifest ... >
  <!-- This attribute is "false" by default on apps targeting
       Android 10 or higher. -->
  <application android:requestLegacyExternalStorage="true" ... >
    ...
  </application>
</manifest>

Adding support for Scoped Storage may require breaking changes since

  • We can’t access documents directly from Mediastore, need to use Storage Access Framework
  • DATA column is deprecated which is used to ignored files

Support will be added in upcoming releases. Any contributions are welcome.

1reaction
jaiselrahmancommented, Nov 19, 2019

Android 10 support has been added in version 1.3.0. Change log is here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android 10 features and APIs
Wi-Fi network connection API. Android 10 adds support for peer-to-peer connections. This feature enables your app to prompt the user to change the...
Read more >
API Levels | Android versions, SDK/API levels, version codes ...
Version SDK / API level Version code Codename Cumulative usage Year Android 13 Level 33 TIRAMISU Tiramisu 2.0% 2022 Android 12 Level 32 Android 12L...
Read more >
What is API level 29, as it relates to DA deprecation?
By November 1, 2020, Google requires all apps to update to API level 29, which corresponds with Android 10 (Q). So by this...
Read more >
Unable to start API 29 emulator (Android 10) - Stack Overflow
After many tests the only thing that worked for me was: Uninstall Intel Hardware Accelerated Execution Manager (HAXM) version v7.7.0 ...
Read more >
Support API level 29 (Android 10) · Issue #830 - GitHub
Feature Request Motivation Behind Feature Because android 10 is announced and released, platforms should be updated to version 29 when I do ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found