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

Kotify not working on RELEASE MODE #4

Closed
PMARZV opened this issue Dec 14, 2022 · 0 comments
Closed

Kotify not working on RELEASE MODE #4

PMARZV opened this issue Dec 14, 2022 · 0 comments

Comments

@PMARZV
Copy link

PMARZV commented Dec 14, 2022

I was implementing Kotify in an app and everything workedd correctly in debug mode. When i switched to release mode, it does not work. I have a try/catch that tris to do the code and then with an adapter i put it on the app and the catch returns another view in the app. In debug mode everything works correctly and the TRY is triggered. But in release, it triggers the CATCH meaning thatt the code has failed (api call)
CODE TRY CATCH

  lifecycleScope.launch {
        try {

                val kotify = Kotify(
                    clientID = "5ef1e8a612cb4f12b3343ad26427ec93",
                    clientSecret = "6752b38c773741ea8e15404e613bea83"
                )

                val playlist: List<PlaylistPagination.Item> =
                    kotify.playlists.get("37i9dQZEVXbMDoHDwVN2tF").tracks.items


                val tracks: ArrayList<Track> = playlist.map { it.track } as ArrayList<Track>

                for (i in 0 until tracks.count()) {


                    val SEVERALartistsname: ArrayList<Artist> =
                        tracks[i].artists as ArrayList<Artist>
                    for (o in 0 until SEVERALartistsname.count()) {
                        if (artistname == null) {
                            artistname = SEVERALartistsname[o].name
                        } else {
                            artistname = artistname + ", " + SEVERALartistsname[o].name
                        }
                    }


                    val SEVERALalbumimg: ArrayList<Image> =
                        tracks[i].album?.images as ArrayList<Image>
                    val artworkTrack = SEVERALalbumimg[2].url


                    val songname = tracks[i].name ?: "N/A"
                    val nameartist = songname + System.lineSeparator() + artistname


                    courseList2.add(namespoty(i + 1, nameartist, artworkTrack))
                    SEVERALartistsname.clear()
                    artistname = null


                }

            val courseRVAdapter2 = CourseRVAdapter2(courseList2, true)
            courseRV.adapter = courseRVAdapter2

            loadingPB.visibility = View.GONE

        } catch(e:Exception){
            Log.i("HELLO", "CATCH")
            loadingPB.visibility = View.GONE
            Log.i("HELLO", "CATCH2")
            courseList2.add(namespoty(null,"",""))
            val courseRVAdapter2 = CourseRVAdapter2(courseList2, false)
            Log.i("HELLO", "CATCH3")
            courseRV.adapter = courseRVAdapter2
            Log.i("HELLO", "CATCHEND")
        }

it has to do with the relase mode and a thing to mention is that i have the proguard rules activated and i dont now if i have to add a rule excluding and which one! I would help a lot!
Your work is awesome! (take into account that is release mode and i dont have the logcat to see wheres the error so im stuck)

@PMARZV PMARZV closed this as completed Jan 2, 2023
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

1 participant