Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Android 11 #23

Open
ardon-dev opened this issue Feb 5, 2021 · 29 comments
Open

Crash on Android 11 #23

ardon-dev opened this issue Feb 5, 2021 · 29 comments
Assignees

Comments

@ardon-dev
Copy link

Describe the bug
Application crashes when gligar activity is launched (After allow permissions for the first time too).

To Reproduce
Steps to reproduce the behavior:

  1. Launch gligar activity.
  2. Allow permissions.
  3. App will crash.

Expected behavior
Show the list of local image files.

Include stack trace if exist
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/AndroidRuntime: FATAL EXCEPTION: main
Process: avanceingenieros.com.app, PID: 6152
java.lang.IllegalArgumentException: Invalid token LIMIT
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:472)
at android.content.ContentResolver.query(ContentResolver.java:1183)
at android.content.ContentResolver.query(ContentResolver.java:1115)
at android.content.ContentResolver.query(ContentResolver.java:1071)
at com.opensooq.supernova.gligar.dataSource.ImagesDataSource.loadAlbumImages(ImagesDataSource.kt:64)
at com.opensooq.supernova.gligar.ui.PickerViewModel$getImages$2.invokeSuspend(PickerViewModel.kt:99)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Smartphone (please complete the following information):

  • Device: Pixel 4XL (Emulator)
  • OS: Android 11
@ateeqrehman33
Copy link

please help me solve this

@Shay-BH
Copy link

Shay-BH commented Feb 25, 2021

You need to remove the LIMIT from ImageDataSource -> loadAlbumImages function

@Mahmudul531
Copy link

You need to remove the LIMIT from ImageDataSource -> loadAlbumImages function

How to limit users to select only one image from galary.

@sumeet3110
Copy link

How to limit users to select only one image from galary.
-> you can use new GligarPicker().requestCode(PICKER_REQUEST_CODE).limit(1). limit function like this but it wont help you, stil it is crashing...

@Mahmudul531
Copy link

Yes, I have tried many ways but I think there is a permission-related issue which must have to fix in the library.
Now roll back to own ways of Gallery and Camera taking photos.

@Shay-BH
Copy link

Shay-BH commented Mar 14, 2021

I fixed the issues for Android 11, please use this class:
internal class ImagesDataSource(private val contentResolver: ContentResolver){

fun getCursorUri(): Uri {

    val collection: Uri
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        collection = newCursorUri;
    } else {
        collection = cursorUri;
    }

    return collection;
}

fun loadAlbums(): ArrayList<AlbumItem> {
    val albumCursor = contentResolver.query(
            getCursorUri(),
            arrayOf(DISPLAY_NAME_COLUMN, MediaStore.Images.ImageColumns.BUCKET_ID),
            null,
            null,
            ORDER_BY
    )
    val list = arrayListOf<AlbumItem>()
    try {
        list.add(AlbumItem("All", true, "0"))
        if (albumCursor == null) {
            return list
        }
        albumCursor.doWhile {
            try {
                val bucketId = albumCursor.getString(albumCursor.getColumnIndex(MediaStore.Images.ImageColumns.BUCKET_ID))
                val name = albumCursor.getString(albumCursor.getColumnIndex(DISPLAY_NAME_COLUMN))
                        ?: bucketId
                var albumItem = AlbumItem(name, false, bucketId)
                if (!list.contains(albumItem)) {
                    list.add(albumItem)
                }
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (albumCursor != null && !albumCursor.isClosed) {
            albumCursor.close()
        }
    }
    return list
}

fun loadAlbumImages(
        albumItem: AlbumItem?,
        page: Int
): ArrayList<ImageItem> {
    val offset = page * PAGE_SIZE
    val list: ArrayList<ImageItem> = arrayListOf()
    var photoCursor: Cursor? = null
    try {
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {

            val bundle = Bundle().apply {
                putInt(ContentResolver.QUERY_ARG_LIMIT, PAGE_SIZE)
                putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
                putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")
            }

            photoCursor = contentResolver.query(
                getCursorUri(),
                arrayOf(
                    ID_COLUMN,
                    PATH_COLUMN
                ),
                bundle,
                null
            )
        }
        else {
            if (albumItem == null || albumItem.isAll) {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    null,
                    null,
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            } else {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    "${MediaStore.Images.ImageColumns.BUCKET_ID} =?",
                    arrayOf(albumItem.bucketId),
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            }
        }
        photoCursor?.isAfterLast ?: return list
        photoCursor.doWhile {
            try {
                val image = photoCursor.getString((photoCursor.getColumnIndex(PATH_COLUMN)))
                list.add(ImageItem(image, ImageSource.GALLERY, 0))
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (photoCursor != null) {
            if (!photoCursor.isClosed()) {
                photoCursor.close()
            }
        }
    }
    return list
}

}

@sumeet3110
Copy link

@Shay-BH Thanks its working now :)

@ateeqrehman33
Copy link

Hello, Can you guide me how to edit "ImagesDataSource" file. Its showing file is read only.

@meetr-spaceo
Copy link

@Shay-BH
What to place in "newCursorUri" in Constant

@HassanGlixenTech
Copy link

Hi @Shay-BH @sumeet3110. Can you please guide me what to place as newCursorUri.
Thanks!

@AlexStroia
Copy link

AlexStroia commented Apr 13, 2021

@HassanGlixenTech you need to place it in Const.kt

@HassanGlixenTech
Copy link

HassanGlixenTech commented Apr 13, 2021

@HassanGlixenTech you need to place it in Const.kt
@AlexStroia What could be the value of that constant. If you can guide me that would be really helpful as i am newbie at this topic.

@sumeet3110
Copy link

@ateeqrehman33 Hi you have to make this library as a dependency to your project (Download it and add it your project) then you will able to edit ImageDataSource file..

@HassanGlixenTech
Copy link

HassanGlixenTech commented Apr 13, 2021

@ateeqrehman33 I already have access to ImageDataSource. I just need to find out what can be the value placed at this position
image

@sumeet3110
Copy link

@HassanGlixenTech I have used the same as cursorUri and it is working for me .

Yazan98 pushed a commit to Yazan98/Gligar that referenced this issue Apr 29, 2021
Yazan98 pushed a commit to Yazan98/Gligar that referenced this issue Apr 29, 2021
@ibrahim-iqbal
Copy link

Still getting this error, has it been FIXED ?

@iamAliRaza
Copy link

Kindly merge the pull request Yazan98 this user already fixed all the issues. My bad luck i am using it in my main application. For now i import it as a module and fixed it on my side but its a temporary fix that i did .. i am waiting for your update.

Thanks

@sohrab-fallahzadeh
Copy link

Kindly merge the pull request Yazan98 this user already fixed all the issues. My bad luck i am using it in my main application. For now i import it as a module and fixed it on my side but its a temporary fix that i did .. i am waiting for your update.

Thanks

Please tell me the solution to this problem. I could not solve the problem with what was said

@sakib143
Copy link

I fixed the issues for Android 11, please use this class:
internal class ImagesDataSource(private val contentResolver: ContentResolver){

fun getCursorUri(): Uri {

    val collection: Uri
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        collection = newCursorUri;
    } else {
        collection = cursorUri;
    }

    return collection;
}

fun loadAlbums(): ArrayList<AlbumItem> {
    val albumCursor = contentResolver.query(
            getCursorUri(),
            arrayOf(DISPLAY_NAME_COLUMN, MediaStore.Images.ImageColumns.BUCKET_ID),
            null,
            null,
            ORDER_BY
    )
    val list = arrayListOf<AlbumItem>()
    try {
        list.add(AlbumItem("All", true, "0"))
        if (albumCursor == null) {
            return list
        }
        albumCursor.doWhile {
            try {
                val bucketId = albumCursor.getString(albumCursor.getColumnIndex(MediaStore.Images.ImageColumns.BUCKET_ID))
                val name = albumCursor.getString(albumCursor.getColumnIndex(DISPLAY_NAME_COLUMN))
                        ?: bucketId
                var albumItem = AlbumItem(name, false, bucketId)
                if (!list.contains(albumItem)) {
                    list.add(albumItem)
                }
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (albumCursor != null && !albumCursor.isClosed) {
            albumCursor.close()
        }
    }
    return list
}

fun loadAlbumImages(
        albumItem: AlbumItem?,
        page: Int
): ArrayList<ImageItem> {
    val offset = page * PAGE_SIZE
    val list: ArrayList<ImageItem> = arrayListOf()
    var photoCursor: Cursor? = null
    try {
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {

            val bundle = Bundle().apply {
                putInt(ContentResolver.QUERY_ARG_LIMIT, PAGE_SIZE)
                putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
                putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")
            }

            photoCursor = contentResolver.query(
                getCursorUri(),
                arrayOf(
                    ID_COLUMN,
                    PATH_COLUMN
                ),
                bundle,
                null
            )
        }
        else {
            if (albumItem == null || albumItem.isAll) {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    null,
                    null,
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            } else {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    "${MediaStore.Images.ImageColumns.BUCKET_ID} =?",
                    arrayOf(albumItem.bucketId),
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            }
        }
        photoCursor?.isAfterLast ?: return list
        photoCursor.doWhile {
            try {
                val image = photoCursor.getString((photoCursor.getColumnIndex(PATH_COLUMN)))
                list.add(ImageItem(image, ImageSource.GALLERY, 0))
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (photoCursor != null) {
            if (!photoCursor.isClosed()) {
                photoCursor.close()
            }
        }
    }
    return list
}

}

Thanks and It is working

@sohrab-fallahzadeh
Copy link

I could not add this project as a package to my project so I could edit it!
Please explain how to add and edit this project to our project ...

@omkar-tenkale
Copy link

omkar-tenkale commented Aug 27, 2021

Use

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

implementation 'com.github.omkar-tenkale:Gligar:78d8110102e0be4e1e2f939b5307ae5f645e6761'

instead of

implementation 'com.opensooq.supernova:gligar:1.1.0'

Based on pull request
#25

@sohrab-fallahzadeh
Copy link

Use

implementation 'com.github.omkar-tenkale:Gligar:78d8110102e0be4e1e2f939b5307ae5f645e6761'

instead of

implementation 'com.opensooq.supernova:gligar:1.1.0'

Based on pull request
#25

thank you
I tried your method
But again an error occurred
And the program crashed

ERR

@omkar-tenkale
Copy link

try
File > Invalid caches/Restart

@massimilianochiodi
Copy link

I have same problem

E/AndroidRuntime: FATAL EXCEPTION: main Process: it.nexid.ivoting, PID: 11134 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ViewModelKt; at com.opensooq.supernova.gligar.ui.PickerViewModel.loadAlbums$gligar_release(PickerViewModel.kt:80) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.loadAlbums(ImagePickerActivity.kt:137) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.storagePermissionGranted(ImagePickerActivity.kt:142) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.checkStoragePermission(ImagePickerActivity.kt:190) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.onResume(ImagePickerActivity.kt:406) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456) at android.app.Activity.performResume(Activity.java:8353) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4889) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4936) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8595) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ViewModelKt" on path: DexPathList[[zip file "/data/app/~~TKOg2FjMjw4LEPP7lLtf9w==/it.nexid.ivoting-mr-dzpUGyp5Y-8l8aVapFw==/base.apk"],nativeLibraryDirectories=[/data/app/~~TKOg2FjMjw4LEPP7lLtf9w==/it.nexid.ivoting-mr-dzpUGyp5Y-8l8aVapFw==/lib/arm64, /system/lib64, /system/system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.opensooq.supernova.gligar.ui.PickerViewModel.loadAlbums$gligar_release(PickerViewModel.kt:80)  at com.opensooq.supernova.gligar.ui.ImagePickerActivity.loadAlbums(ImagePickerActivity.kt:137)  at com.opensooq.supernova.gligar.ui.ImagePickerActivity.storagePermissionGranted(ImagePickerActivity.kt:142)  at com.opensooq.supernova.gligar.ui.ImagePickerActivity.checkStoragePermission(ImagePickerActivity.kt:190)  at com.opensooq.supernova.gligar.ui.ImagePickerActivity.onResume(ImagePickerActivity.kt:406)  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)  at android.app.Activity.performResume(Activity.java:8353)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4889)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4936)  at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)  at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:246)  at android.app.ActivityThread.main(ActivityThread.java:8595)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)  V/FA: Connection attempt already in progress V/FA: Connection attempt already in progress I/Process: Sending signal. PID: 11134 SIG: 9
i try
File > Invalid caches/Restart but no effect

@sohrab-fallahzadeh
Copy link

try
File > Invalid caches/Restart

I tried this
The program crashed again

@omkar-tenkale
Copy link

omkar-tenkale commented Sep 20, 2021

Regarding crash java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ViewModelKt; at

This doesnt occur to me nor it seems related to lib

you can try
Add the dependencies in the build.gradle of the app in my scenario was using a library that needed those dependencies

For android X

implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"

Make sure android X is enabled with gradle.properties and Jetfier enabled

     android.useAndroidX=true
     android.enableJetifier=true

https://stackoverflow.com/questions/44075089/noclassdeffounderror-landroid-arch-lifecycle-lifecycledispatcher

@Harshal624
Copy link

I fixed the issues for Android 11, please use this class: internal class ImagesDataSource(private val contentResolver: ContentResolver){

fun getCursorUri(): Uri {

    val collection: Uri
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        collection = newCursorUri;
    } else {
        collection = cursorUri;
    }

    return collection;
}

fun loadAlbums(): ArrayList<AlbumItem> {
    val albumCursor = contentResolver.query(
            getCursorUri(),
            arrayOf(DISPLAY_NAME_COLUMN, MediaStore.Images.ImageColumns.BUCKET_ID),
            null,
            null,
            ORDER_BY
    )
    val list = arrayListOf<AlbumItem>()
    try {
        list.add(AlbumItem("All", true, "0"))
        if (albumCursor == null) {
            return list
        }
        albumCursor.doWhile {
            try {
                val bucketId = albumCursor.getString(albumCursor.getColumnIndex(MediaStore.Images.ImageColumns.BUCKET_ID))
                val name = albumCursor.getString(albumCursor.getColumnIndex(DISPLAY_NAME_COLUMN))
                        ?: bucketId
                var albumItem = AlbumItem(name, false, bucketId)
                if (!list.contains(albumItem)) {
                    list.add(albumItem)
                }
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (albumCursor != null && !albumCursor.isClosed) {
            albumCursor.close()
        }
    }
    return list
}

fun loadAlbumImages(
        albumItem: AlbumItem?,
        page: Int
): ArrayList<ImageItem> {
    val offset = page * PAGE_SIZE
    val list: ArrayList<ImageItem> = arrayListOf()
    var photoCursor: Cursor? = null
    try {
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {

            val bundle = Bundle().apply {
                putInt(ContentResolver.QUERY_ARG_LIMIT, PAGE_SIZE)
                putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
                putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")
            }

            photoCursor = contentResolver.query(
                getCursorUri(),
                arrayOf(
                    ID_COLUMN,
                    PATH_COLUMN
                ),
                bundle,
                null
            )
        }
        else {
            if (albumItem == null || albumItem.isAll) {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    null,
                    null,
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            } else {
                photoCursor = contentResolver.query(
                    getCursorUri(),
                    arrayOf(
                        ID_COLUMN,
                        PATH_COLUMN
                    ),
                    "${MediaStore.Images.ImageColumns.BUCKET_ID} =?",
                    arrayOf(albumItem.bucketId),
                    "$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
                )
            }
        }
        photoCursor?.isAfterLast ?: return list
        photoCursor.doWhile {
            try {
                val image = photoCursor.getString((photoCursor.getColumnIndex(PATH_COLUMN)))
                list.add(ImageItem(image, ImageSource.GALLERY, 0))
            }
            catch (ex: Exception) {
                ex.printStackTrace()
            }
        }
    } finally {
        if (photoCursor != null) {
            if (!photoCursor.isClosed()) {
                photoCursor.close()
            }
        }
    }
    return list
}

}

This would fix the crash for android 11, but you won't be able to switch albums.

@Harshal624
Copy link

Use this function instead. You will be able to switch albums.

fun loadAlbumImages(
albumItem: AlbumItem?,
page: Int
): ArrayList {
val offset = page * PAGE_SIZE
val list: ArrayList = arrayListOf()
var photoCursor: Cursor? = null
try {
val selection = "${MediaStore.Images.ImageColumns.BUCKET_ID} =?"
if (albumItem == null || albumItem.isAll) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
val bundle = Bundle().apply {
putInt(ContentResolver.QUERY_ARG_LIMIT, PAGE_SIZE)
putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")
}
photoCursor = contentResolver.query(
cursorUri,
arrayOf(
ID_COLUMN,
PATH_COLUMN
),
bundle,
null
)
} else {
photoCursor = contentResolver.query(
cursorUri,
arrayOf(
ID_COLUMN,
PATH_COLUMN
),
null,
null,
"$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
)
}
} else {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
val bundle = Bundle().apply {
putInt(ContentResolver.QUERY_ARG_LIMIT, PAGE_SIZE)
putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")
putString(ContentResolver.QUERY_ARG_SQL_SELECTION, selection)
putStringArray(ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS, arrayOf(albumItem.bucketId))
}
photoCursor = contentResolver.query(
cursorUri,
arrayOf(
ID_COLUMN,
PATH_COLUMN
),
bundle,
null
)
} else {
photoCursor = contentResolver.query(
cursorUri,
arrayOf(
ID_COLUMN,
PATH_COLUMN
),
selection,
arrayOf(albumItem.bucketId),
"$ORDER_BY LIMIT $PAGE_SIZE OFFSET $offset"
)
}
}
photoCursor?.isAfterLast ?: return list
photoCursor.doWhile {
val image = photoCursor.getString((photoCursor.getColumnIndex(PATH_COLUMN)))
list.add(ImageItem(image, ImageSource.GALLERY, 0))
}
} finally {
if (photoCursor != null && !photoCursor.isClosed()) {
photoCursor.close()
}
}
return list
}

@Jayraj2001
Copy link

Use

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
implementation 'com.github.omkar-tenkale:Gligar:78d8110102e0be4e1e2f939b5307ae5f645e6761'

instead of

implementation 'com.opensooq.supernova:gligar:1.1.0'

Based on pull request #25

It runs, Thanks a much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests