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

Deploy separate build artifact for Android with protobuf-lite #18

Open
abonander opened this issue Oct 4, 2019 · 1 comment
Open

Deploy separate build artifact for Android with protobuf-lite #18

abonander opened this issue Oct 4, 2019 · 1 comment

Comments

@abonander
Copy link
Contributor

abonander commented Oct 4, 2019

This package as-is when imported in the Java SDK cannot be used subsequently in an Android project without increasing the minApiVersion to 26 which cuts off about 63% of the market according to https://developer.android.com/about/dashboards

This is because the regular protobuf-java package is not built for Android and uses intrinsics that are too new:

> Transform artifact protobuf-java.jar (com.google.protobuf:protobuf-java:3.10.0) with DexingNoClasspathTransform
AGPBI: {"kind":"error","text":"MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}

The official recommendation is to use protobuf-lite which is a separate package with differently named classes and a different protoc invocation: https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md

We can switch this out with profiles and tag the Android configuration with a android classifier, then build and deploy both the full Java version with no classifier and a lightweight Android version with the android classifier:

(We can then use the same approach to switch which version of the hedera-protobuf package we use in the Java SDK.)

@mehcode
Copy link
Collaborator

mehcode commented Nov 14, 2019

Is still needed? Does it affect anything if we do it on if not?

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

2 participants