ExceptionInInitializerError with tink-android 1.3.0-rc2 #289
Comments
Hmm not sure what happened. I'd need to loop in the Protobuf team to make sure protobuf-javalite is the correct dependency for Java lite these day. |
Protobuf team recently released new 3.11 version with major fix for android.
Please update tink dependency and release 1.3.0 artifact with dependency on 3.11 protobuf-javalite |
I tried protobuf-javalite 3.11 with tink-android 1.3.0-rc2 and got the same issue |
SteinerOk: can you try with After talking to the protobuf team I think I understand what happened. The protobuf code (e.g., RegistryConfig) in 1.3.0-RC2 was generated using Bazel's java_lite_proto_library which is only compatible with the runtime A potential solution is to move back to We can also wait till java_lite_proto_library is moved to the new runtime (see protocolbuffers/protobuf#6882), then release RC3. I'm still not sure what the best option is. Will work with internal experts to sort it out. Stay tuned! |
@thaidn I tried with this config:
On first look it works) |
@SteinerOk I independently arrived at a similar solution, though in my case I instead forced tink-android 1.2.2 to use protobuf-javalite 3.9.2. I haven't seen any problems with that approach yet, but I'll be monitoring this issue and updating as I go. Edit: I ran into #253 with my approach. I will try yours exactly. |
Could you please try again with HEAD-SNAPSHOT? This problem is pretty complicated. Tink includes some auto generated Protobuf code. It is required that the Protobuf Javalite library that was used to generate the code must be identical to the one found at run time. Tink generates Protobuf code using Bazel's proto_library_javalite which always used an outdated javalite runtime. This was recently fixed with protocolbuffers/protobuf#6976. In HEAD-SNAPSHOT (and, if HEAD-SNAPSHOT works, in RC3,) the Protobuf code in Tink was generated using Protobuf Javalite 3.11.1, which is also the version that the Tink Android artifact in Maven depends on. This should fix this issue for anyone who doesn't have any other direct or indirect dependencies on Protobuf or Protobuf Javalite. If you depend on any different versions of Protobuf or Protobuf Javalite in other places, you want to exclude those dependencies. In other words, you can only use Protobuf 3.11.1. If you have a hard dependency on any other versions, it may or may not work, depending on how lucky you're :). This is because Protobuf Javalite doesn't guarantee API/ABI compatibility. If the Protobuf/Protobuf Javalite versions you need are compatible with 3.11.1, you wouldn't have any problem. Otherwise we're not aware of any solutions. In the future, we'll move away from Protobuf Javalite. This is a huge and potentially backward incompatible change, so it'll take a while for us to get there. |
A small clarification, the change to upgrade to Protobuf Javalite 3.11.1
hasn't landed just yet, as it turns out to not be a drop-in replacement.
I'm going to finish rooting out the issues with dependency
upgrade tomorrow and prepare a rc3 release shortly thereafter.
I'll update the thread as soon as the HEAD-SNAPSHOT version is ready to be
tested for those interested.
…On Fri, Dec 6, 2019 at 6:14 PM Thai Duong ***@***.***> wrote:
Could you please try again with HEAD-SNAPSHOT?
This problem is pretty complicated.
Tink includes some auto generated Protobuf code. It is required that the
Protobuf Javalite library that was used to generate the code must be
identical to the one found at run time.
Tink generates Protobuf code using Bazel's proto_library_javalite which
always used an outdated javalite runtime. This was recently fixed with
protocolbuffers/protobuf#6976
<protocolbuffers/protobuf#6976>.
In HEAD-SNAPSHOT (and, if HEAD-SNAPSHOT works, in RC3,) the Protobuf code
in Tink was generated using Protobuf Javalite 3.11.1, which is also the
version that the Tink Android artifact in Maven depends on. This should fix
this issue for anyone who doesn't have any other direct or indirect
dependencies on Protobuf or Protobuf Javalite.
If you depend on any different versions of Protobuf or Protobuf Javalite
in other places, you want to exclude those dependencies. In other words,
you can only use Protobuf 3.11.1. If you have a hard dependency on any
other versions, it may or may not work, depending on how lucky you're :). *This
is because Protobuf Javalite doesn't guarantee API/ABI compatibility.* If
the Protobuf/Protobuf Javalite versions you need are compatible with
3.11.1, you wouldn't have any problem. Otherwise we're not aware of any
solutions.
In the future, we'll move away from Protobuf Javalite. This is a huge and
potentially backward incompatible change, so it'll take a while for us to
get there.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#289>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACVM2MFBJNGL77VONOQU63QXMBIXANCNFSM4JR3YUCA>
.
|
In d898bdd, the javalite protobuf dependency has been updated, along with a handful of other updates that the dependency upgrade necessitated. The Android Hello World example app specifies the HEAD-SNAPSHOT version of Tink as a dependency. Previously, the app failed with the same error reported in this issue. I just tested now that the HEAD-SNAPSHOT version has been updated and was able to successfully execute the app. I'll planning on putting together a 1.3.0-rc3 release with this change included, so you can test with HEAD-SNAPSHOT now and/or wait until the new release candidate is published. |
Sorry for the delay, but 1.3.0-rc3 has been released. Let me know if you're still experiencing the issue. |
I'm going to tentatively close this, given the successful testing with HEAD-SNAPSHOT noted above. Please re-open if you find that the problem persists. |
Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-javalite-3.11.1.jar (com.google.protobuf:protobuf-javalite:3.11.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1) Go to the documentation to learn how to Fix dependency resolution errors. |
After update tink-android to 1.3.2
Got this error, when try TinkConfig.register()
Dependency:
With tink-android:1.3.0-rc1 all works fine
The text was updated successfully, but these errors were encountered: