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

Unable to use dgca-app-core-android on Android 7 (24) devices #56

Open
robzerg opened this issue Aug 5, 2021 · 2 comments
Open

Unable to use dgca-app-core-android on Android 7 (24) devices #56

robzerg opened this issue Aug 5, 2021 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@robzerg
Copy link

robzerg commented Aug 5, 2021

Hi,

I integrated your dgci-app-core-android library in my app which is minsdk 24 (Android 7).
Your decoder is working fine except on Android 7 devices.

What is the reason that your libraries minSDK is 26?
Is there a way to make it work for SDK 24 (Android 7) devices?

Thanks or your feedback!

Best regards
Robert

@robzerg robzerg added the question Further information is requested label Aug 5, 2021
@robzerg
Copy link
Author

robzerg commented Aug 5, 2021

You use Java 8 time api which is available since api 26.

You could use time api on api < 26 by following the steps in this artice: https://tunesoftware.com/apps/java-8-date-time-classes-in-android-below-api-26/

Don't know if this interests you somehow :)

@lubagov
Copy link

lubagov commented Jan 18, 2022

I month ago try to use Android 7.0, 24 API level, it fine working, expect one thing. Java time API can be fixed over "deshugaring" gradle plugin.
But Kotlin reflection API not work correct:

    compileOptions {
        sourceCompatibility Config.javaVersion
        targetCompatibility Config.javaVersion
        coreLibraryDesugaringEnabled true
    }

So you need enable, some like, in dependences app level:
coreLibraryDesugaring Deps.desugar_jdk_libs
and in Versions.kt:
const val desugar_jdk_libs = "1.1.5"
and dependences.kt:
const val desugar_jdk_libs = "com.android.tools:desugar_jdk_libs:${Versions.desugar_jdk_libs}"
then instead of ZonedDateTime when running on API 24 it will convert it to Date.
And this all things already enabled in sources...

One more thing if i remember correct... it is, in file dgc-certlogic-android/engine/src/main/java/dgca/verifier/app/engine/data/ExternalParameter.kt

class ExternalParameter private constructor(
    val validationClock: String,
    val valueSets: Map<String, List<String>>,
    val countryCode: String,
    val exp: String,
    val iat: String,
    val issuerCountryCode: String,
    val kid: String,
    val region: String = ""
) {
    companion object {
        fun createInstance(
            validationClock: ZonedDateTime,
            valueSets: Map<String, List<String>>,
            countryCode: String,
            exp: ZonedDateTime,
            iat: ZonedDateTime,
            issuerCountryCode: String,
            kid: String,
            region: String = ""
        ):ExternalParameter{
            return ExternalParameter(
                validationClock = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(validationClock),
                valueSets = valueSets,
                countryCode = countryCode,
                exp = exp.withZoneSameInstant(UTC_ZONE_ID).toLocalDate().toString(),
                iat = iat.withZoneSameInstant(UTC_ZONE_ID).toLocalDate().toString(),
                issuerCountryCode = issuerCountryCode,
                kid = kid,
                region = region
            )
        }
    }
}

And create it over factory. The problem was that it did not find the constructor, it tried to look for the constructor with ZonedDateTime and in fact, during the de-sugaring process, it was replaced with Date. Although... I can't now repeat this issue on a device with API level 25, and Android 7.1 right now.

Also has problem with:
@dimen/default_padding
It request level 28, so it need remove....

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

No branches or pull requests

3 participants