g0dkar / qrcode-kotlin

QRCode Generator implemented in pure Kotlin
https://qrcodekotlin.com/
MIT License
192 stars 20 forks source link

Android minimum version requirement #89

Closed realh closed 1 year ago

realh commented 1 year ago

I tried to update my project's gradle file to use qrcode-kotlin 4.0.3, but now it won't build because my Android minSdk is 23 and this library wants 24 or newer. I'd like to keep supporting 23 because it makes about a 5% difference to the number of supported devices. Would it be possible for you to restore support for Android API 23 in version 4?

g0dkar commented 1 year ago

Sure thing! I just noticed this myself hahaha, I'll change it for v4.0.5 along fixes for the Jetpack Compose (issue #88)

Thanks for sharing <3

g0dkar commented 1 year ago

Heya @realh! Can you check v4.0.5 that was just released? I've reduced the minimum SDK back to 23 :)

realh commented 1 year ago

4.0.5 isn't working for me. import io.github.g0dkar.qrcode.QRCode causes an 'Unresolved reference: QRCode' error. If I hover over the error/code for val qr = QRCode(data = payload) the IDE suggests I import qrcode.QRCode instead, and labels the suggestion with Gradle: io.github.g0dkar:qrcode-kotlin-android:4.0.5@aar (classes.jar). This seems to import a class that's not the same as the one I was using before. The encode and computeImageSize methods are missing and render has a different signature. It's now expecting

public final fun render(
    qrCodeGraphics: QRCodeGraphics,
    xOffset: Int,
    yOffset: Int
): QRCodeGraphics

instead of

public final fun render(
    cellSize: Int,
    margin: Int,
    rawData: Array<Array<QRCodeSquare?>>,
    qrCodeGraphics: QRCodeGraphics,
    brightColor: Int,
    darkColor: Int,
    marginColor: Int
): QRCodeGraphics
g0dkar commented 1 year ago

Heya! Unfortunately due to a bunch of optimizations, internal and external changes I had to change the API a bit.

The io.github.g0dkar.qrcode.QRCode from v3 is now qrcode.raw.QRCodeProcessor, the API should be largely unchanged :) - all that was changed was adding a pair of integers on the rendering callback on renderShaded()

Could you try this change and see if all works? If not, I'll try to come up with a less breaking change 😅

Edit: sorry for the inconvenience and headaches =/

LossyDragon commented 1 year ago

Chiming in here for my issue as well!

Looks to be working good using 4.0.5, even though I'm using the bare basics of this library. 😄

However, would it be possible to maybe hush up the logging from QRCodeGraphics.android.kt? The spam of that in the log cat pretty much fills up the buffer from AS.

g0dkar commented 1 year ago

Oof my bad hahahahahahaha, I'll remove the Logs asap

An old meme for your troubles: maxresdefault-944889991

realh commented 1 year ago

QRCodeProcessor works for me in 4.0.6. Sorry about the delay.

g0dkar commented 1 year ago

No problem @realh! Thanks for the feedback! Let me know if there's anything else ^^

Doomsdayrs commented 11 months ago

Can the minimum version be dropped even lower, to 22 instead?

g0dkar commented 11 months ago

Heya @Doomsdayrs! I think so, I'll give it a try :D

[Edit: afaik, all that is used from Android is the Bitmap class, which according to docs comes from way back on v1]