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

Update protobuf-java-util gson dep from v2.7 to v2.8.1 #3531

Closed
bootstraponline opened this issue Aug 20, 2017 · 9 comments · Fixed by #6268
Closed

Update protobuf-java-util gson dep from v2.7 to v2.8.1 #3531

bootstraponline opened this issue Aug 20, 2017 · 9 comments · Fixed by #6268

Comments

@bootstraponline
Copy link

protobuf-java-util isn't using the latest gson. I had to add a gradle exclude rule. It'd be nice to update to the latest stable version.

@liujisi
Copy link
Contributor

liujisi commented Aug 21, 2017

Will the 2.8.1 be binary compatible with 2.7? I'm just cautious about whether this will break other users of protobuf.

@bootstraponline
Copy link
Author

Will the 2.8.1 be binary compatible with 2.7?

I'm not sure. Is there a way to tell?

@liujisi
Copy link
Contributor

liujisi commented Aug 21, 2017

@xfxyjwf

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Aug 21, 2017

Are you directly depending on a newer version of gson? If so, can't gradle pick the newer version automatically?

@bootstraponline
Copy link
Author

I have to do this:

androidTestCompile('io.grpc:grpc-protobuf:1.5.0') {
  exclude group: 'com.google.code.gson', module: 'gson'
}

It works fine so there's no problem. I was just wondering when these dependencies get updated in protobuf-java-util after upstream has made a new stable release?

It's possible that upgrading would break people.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Aug 21, 2017

What happens if you don't use "exclude ..."?

@bootstraponline
Copy link
Author

What happens if you don't use "exclude ..."?

This:

Error:Conflict with dependency 'com.google.code.gson:gson' in project ':app'. Resolved versions for app (2.8.1) and test app (2.7) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Aug 21, 2017

This seems an issue in your configuration. Have you tried the suggestions in the linked android studio doc? Specifically it suggests:

If the error is about an indirect dependency (a library you didn't mention
in your build.gradle), just add a dependency for the newer version to the
configuration ("compile" or "androidTestCompile") that needs it.

@bootstraponline
Copy link
Author

Have you tried the suggestions in the linked android studio doc?

The app is setting the required version of gson via an indirect dependency. If I explicitly depend on a version of gson, that will work for now but may break in the future.

Excluding means I'm using the same version of gson as the app, regardless of which version that happens to be. I don't have to update it in the future.

Ideally the dependencies would update over time. If gson ever broke their API then this exclude strategy would stop working. I'm not sure what kind of guarantees they provide around API stability.

To clarify there are a few options which work:

  • Explicitly depend on gson & update version over time
  • Exclude gson from grpc-protobuf

I'm mostly interested in why grpc-protobuf depends on gson from 2016. It sounds like there are compatibility concerns around upgrading.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants