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

Interoperability with protobuf-kotlin and protobuf-kotlin-lite #273

Open
chrispix99 opened this issue Apr 16, 2024 · 0 comments
Open

Interoperability with protobuf-kotlin and protobuf-kotlin-lite #273

chrispix99 opened this issue Apr 16, 2024 · 0 comments

Comments

@chrispix99
Copy link

chrispix99 commented Apr 16, 2024

The problem

We are using protobuf in our application, and we are making use of the full library (not just lite), for things like pack, unpack, optional. We are able to get the app to compile, but when launching the application we get an exception. com.google.protobuf.Timestamp): [0x13] register v3 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLite

Environment

Android OS Version e.g. 13
Android Devices/Emulators e.g. Pixel 6a emulator

Steps to Reproduce

Have an app that uses full version of protobuf-kotlin.. Here is part of the build.gradle

plugins {
...
    id("com.google.protobuf") version "0.9.3"
}
...
dependencies {
 implementation("com.google.protobuf:protobuf-kotlin:${rootProject.ext["protobufVersion"]}")

    implementation("io.grpc:grpc-kotlin-stub:${rootProject.ext["grpcKotlinVersion"]}")
    implementation("io.grpc:grpc-stub:1.55.1")
    implementation("io.grpc:grpc-protobuf:1.55.1")
    implementation("io.grpc:grpc-android:1.24.0")
    implementation("io.grpc:grpc-okhttp:1.52.0")

    implementation("com.plaid.link:sdk-core:4.2.0") {
        exclude(group = "com.google.protobuf", module = "protobuf-kotlin-lite")
    }
}

...

protobuf {
    protoc {
        // The artifact spec for the Protobuf Compiler
        artifact = "com.google.protobuf:protoc:${rootProject.ext[ "protobufVersion"]}"
    }
    plugins {
        // Optional: an artifact spec for a protoc plugin, with "grpc" as
        // the identifier, which can be referred to in the "plugins"
        // container of the "generateProtoTasks" closure.
        create("grpc") {
            artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcJavaVersion"]}"
        }
        create("grpckt") {
            artifact = "io.grpc:protoc-gen-grpc-kotlin:${rootProject.ext["grpcKotlinVersion"]}:jdk8@jar"
        }
        create("java") {
            artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcJavaVersion"]}"
        }
        create("kotlin") {
            artifact = "io.grpc:protoc-gen-grpc-kotlin:${rootProject.ext["grpcKotlinVersion"]}:jdk8@jar"
        }
    }

...


    generateProtoTasks {
        all().forEach { task ->
            task.plugins{
                create("java")
                create("kotlin")
                create("grpc")
                create("grpckt")
            }
        }

    }
}

Expected Result

Should not be required to change our dependencies for protobuf. Should be able to at least fork the plaid-core sdk.

Logs

java.lang.VerifyError: Verifier rejected class com.plaid.internal.core.protos.link.api.ClientEventOuterClass$ClientEvent: void com.plaid.internal.core.protos.link.api.ClientEventOuterClass$ClientEvent.mergeClientPublishedAt(com.google.protobuf.Timestamp) failed to verify: void com.plaid.internal.core.protos.link.api.ClientEventOuterClass$ClientEvent.mergeClientPublishedAt(com.google.protobuf.Timestamp): [0x13] register v3 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLite (declaration of 'com.plaid.internal.core.protos.link.api.ClientEventOuterClass$ClientEvent' appears in /data/app/~~4rQLOD-Nw7__XY9QAqVm3g==/com.flipseats.FlipSeatsDebug-SYM6TJ9-UI2SdRRQbvZNAA==/base.apk!classes21.dex)
at com.plaid.internal.q9.a(SourceFile:305)
at com.plaid.link.Plaid$trackSdkOpen$1.invokeSuspend(SourceFile:281)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@58e3cdf, Dispatchers.IO]

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