Closed RocketRider closed 4 years ago
Hi RocketRider,
Are you using Maven or Gradle? I think you can configure Maven to exclude the protobuf lite dep in Tink.
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink-android</artifactId>
<version>1.2.2</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-lite</artifactId>
</exclusion>
</exclusions>
</dependency>
See https://discuss.gradle.org/t/how-do-i-exclude-specific-transitive-dependencies-of-something-i-depend-on/17991 for how to do that with Gradle.
In 1.3.0 we'd upgrade the protobuf-lite dependency.
Hello. I have same problem. My Android project uses io.grpc
with protobuf-javalite
and also androidx.security:security-crypto
. After exclusion of protobuf-lite
which tink depends on app crashed with following stacktrace:
Caused by: java.lang.RuntimeException: Unable to get message info for com.google.crypto.tink.proto.AesSivKeyFormat at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:62) at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143) at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55) at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93) at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107) at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:170) at com.google.crypto.tink.proto.AesSivKeyFormat.<clinit>(AesSivKeyFormat.java:274) at com.google.crypto.tink.proto.AesSivKeyFormat.newBuilder(AesSivKeyFormat.java:133)
If i keep both protobuf artifacts in project it will not complile. The reason : Duplicate class found in modules protobuf-javalite-3.10.0.jar and protobuf-lite-3.0.1.jar
+1, it would be nice if tink-android will depend on javalite protobuf artifact instead of obsolete protobuf-lite
This is fixed with https://github.com/google/tink/commit/9d9dbab453eefab2ba426190c248f96578458a2d.
Can you try again with the HEAD-SNAPSHOT version and report back if you encounter any issue? Instructions are at https://github.com/google/tink/blob/master/docs/JAVA-HOWTO.md#maven.
Version 1.3.0 should include the fix. Yes, we're working hard on it.
Protobuf released 3.11 version with fix for protobuf-javalite requiring API 26 on android. It would be nice if tink-android 1.3.0 artifact will have dependency on 3.11 version of protobuf
Please try with 1.3.0-RC3 and reopen if this is still an issue.
I wanted to integrate the androidx.security:security-crypto library which depends on tink.
When I add the dependency to "com.google.protobuf:protobuf-javalite:3.9.1" the tink code crashes. Without the protobuf dependencie it works fine.
Code:
Error: